You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When in tsconfig.json the "module" compiler option is set to es2015, then vue-tsc produces an error for static imports inside <script setup lang="ts">
For example for this code straight from the vite scaffold:
<scriptsetuplang="ts">// This starter template is using Vue 3 <script setup> SFCs// Check out https://vuejs.org/api/sfc-script-setup.html#script-setupimportHelloWorldfrom'./components/HelloWorld.vue'</script>
This is the error message that is produced:
src/App.vue:1:1 - error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
As you can see, there is no dynamic import in App.vue, only a static one.
Can't update jest and ts-jest yet, because @vue/vue3-jest depends on
jest 27.
Changing tsconfig should get rid of the following error:
Error: src/App.vue(1,1): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
I think this error is a false positive/bug as we do not actually have
any dynamic imports anywhere.
As I understand it, we do not use the output of the typescript
transpilation directly, but it is an intermediate product in the vite
build process.
This issue has been reported as vuejs/language-tools#1263
When in tsconfig.json the "module" compiler option is set to
es2015
, thenvue-tsc
produces an error for static imports inside<script setup lang="ts">
For example for this code straight from the vite scaffold:
This is the error message that is produced:
As you can see, there is no dynamic import in App.vue, only a static one.
I create a minimal failing example repository for this, reproducing the error on
npm run build
: https://github.com/micgro42/Minimal-Failing-Example_volar-dynamic-importIt is the repository produced by
npm create vite@latest
and thetsconfig.json
modified as stated above.As far as I can tell, this started with vue-tsc 0.34.x. That is, it was working fine with 0.33.9 and broke when we tried to upgrade to 0.34.11.
Please let me know if you need any further information.
The text was updated successfully, but these errors were encountered: