-
-
Notifications
You must be signed in to change notification settings - Fork 243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Module has no default export
error with Vue 3 script setup
components in v6.3.5
#668
Comments
Reading through commit 2cfe45f, I realize that your example of script setup component is inaccurate: |
cc @johnsoncodehk (developer of Volar) and @pikax (who knows Vue TypeScript arcane better than me) as they may have an opinion on what would be best here |
Thanks for the feedback - I'm not a Vue developer so pardon my ignorance :) Feel free to open a PR to fix it ;) |
TBH I'm not sure I know enough to help here, and this might be more complicated than you expect. <script setup lang="ts">
defineProps<{ msg: string }>()
const count = 1;
</script> Some developers might also use the experimental sugar ref syntax. I pinged the Vue team to have more inputs on what you can do. In the meantime, maybe you could revert the changes and release a new patch, as this breaks new Vue CLI users? No type checking is probably better than broken type checking 😉 |
The correct type checking of The API may like this: declare function parseTypeCheckableCode(scriptCode: string, scriptSetupCode: string): {
generatedCode,
scriptMappings: {
scriptTextRange: { start: number, end: number},
generatedCodeTextRange: { start: number, end: number},
}[],
scriptSetupMappings: {
scriptSetupTextRange: { start: number, end: number},
generatedCodeTextRange: { start: number, end: number},
}[],
} |
@johnsoncodehk Oh, great, it would be very helpful! |
In Vue 3, when <script> tag has "setup" attribute, SFC parser assigned script block to a separate field called "scriptSetup" ✅ Closes: #668
In Vue 3, when <script> tag has "setup" attribute, SFC parser assigned script block to a separate field called "scriptSetup" ✅ Closes: #668
In Vue 3, when <script> tag has "setup" attribute, SFC parser assigned script block to a separate field called "scriptSetup" ✅ Closes: #668
I created PR #676 - would be nice if someone with vue project could test these changes. I added some examples to e2e tests but I'm not a vue developer, so I may miss something. To test it, clone the repo, run |
🎉 This issue has been resolved in version 6.4.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This issue has been resolved in version 7.0.0-alpha.15 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Hey, I am facing the exact same issue using @vue/composition-api in vue2. I am still in the migration process from options-api, playing with it this seems to not produce any errors
|
vue 2 ( + ts + composition api) still not works. |
Sorry,but my project not wroks with version 7.2.13 of fork-ts-checker-webpack-plugin. new ForkTsCheckerWebpackPlugin({
typescript: {
extensions: {
vue: {
enabled: true,
compiler: '@vue/compiler-sfc',
},
},
},
}), vue file: <template>
<div>
tset {{b}}
</div>
</template>
<script setup lang="ts">
const b:string = 1;
</script> no erros exports |
I'm dropping support for Vue.js. For the last few years, support for Vue.js has been broken, and the implementation of Vue.js integration was a hacky work-around. Unfortunately, TypeScript doesn't expose an API to do that properly, and while I created a microsoft/TypeScript#38736 on the TypeScript repository, the TypeScript team has other priorities. As I won't have time to support this feature and am receiving justified bug reports, I believe it's better to make it clear that Vue.js is not supported by the plugin instead of pretending that it is. |
Sad to hear but understandable, in particular with the official tooling for Vue going for a vite-based setup. Does this mean that you will remove the hacky work-around in a future release? It would be nice if you mention this issue when doing so as I still have lots of codebases that depend on it and would need to lock versions. |
try to ignore the
|
Current behavior
Thank you for your work for a better support of
script setup
When upgrading an application to use v6.3.5, we encounter the following error with Vue 3 components using
script setup
:Expected behavior
Previously, with v6.3.4, there was no error.
Steps to reproduce the issue
This occurs in new projects using Vue CLI v5, with Vue 3 and TypeScript, blocking new CLI users.
Issue reproduction repository
A simple reproduction is available at https://github.com/cexbrayat/no-default-export
If you change the resolution in package.json to use v6.3.4, then
yarn serve
works again.Environment
The text was updated successfully, but these errors were encountered: