Got undefined
variables when using .vue
instead of .js
file!!
#2634
-
QuestionI have a <template>
<div ref="editorEl"></div>
</template>
<script type="module">
import * as monaco from 'monaco-editor';
const testStr = "Test String";
export default {
mounted() {
console.log(test); // <= ``undefined``
console.log(monaco); // <= ``undefined``
}
}
</script> Every variable defined outside of But when I have a import * as monaco from 'monaco-editor';
const test = "Test String";
export default {
template: `
<div ref="editorEl"></div>
`,
mounted() {
console.log(test); // <= work!!!
console.log(monaco); // <= work!!
}
} How can I defined global element scope for my |
Beta Was this translation helpful? Give feedback.
Answered by
falkoschindler
Feb 28, 2024
Replies: 1 comment 1 reply
-
Hi @KiddoV, I think this is because such |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
KiddoV
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @KiddoV,
I think this is because such
import
statements are currently not supported in Vue components. See #1198 for more information.