This problem was firstly discovered in vite/plugin-vue. The reason is that vite/plugin-vue use rewriteDefault function to transform some code like export default, but rewriteDefault function does not consider the syntax export { default } from '...', it causes the syntax error in vite project.
What is expected?
rewriteDefault can transform export { default } from '...' into import xxx from '...'; const ${as} = xxx;
so that vite can work correctly
What is actually happening?
rewriteDefault just ignore the syntax export { default } from '...' and makes vite project wrong.
I had created a PR for vite to solve this problem, but vite maintainers tell me that may be the problem is in rewriteDefault of @vue/compiler-sfc.
I wonder if it is suitable to let rewriteDefault function transform export { default } from '...' into import xxx from '...'; const ${as} = xxx;
The text was updated successfully, but these errors were encountered:
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-d9ekar?file=src/components/HelloWorld.vue
Steps to reproduce
After open the above reproduction, you will see the console shows the error: Uncaught SyntaxError: Duplicate export of 'default'
Relative Issue:vitejs/vite#8008
Relative PR: vitejs/vite#8016
This problem was firstly discovered in vite/plugin-vue. The reason is that vite/plugin-vue use rewriteDefault function to transform some code like
export default
, but rewriteDefault function does not consider the syntaxexport { default } from '...'
, it causes the syntax error in vite project.What is expected?
rewriteDefault can transform
export { default } from '...'
intoimport xxx from '...'; const ${as} = xxx;
so that vite can work correctly
What is actually happening?
rewriteDefault just ignore the syntax
export { default } from '...'
and makes vite project wrong.System Info
Any additional comments?
I had created a PR for vite to solve this problem, but vite maintainers tell me that may be the problem is in rewriteDefault of @vue/compiler-sfc.
I wonder if it is suitable to let rewriteDefault function transform
export { default } from '...'
intoimport xxx from '...'; const ${as} = xxx;
The text was updated successfully, but these errors were encountered: