The syntax export { default } from ...
in vue file leads to Uncaught SyntaxError: Duplicate export of 'default'
#8008
Labels
bug: upstream
Bug in a dependency of Vite
p3-minor-bug
An edge case that only affects very specific usage (priority)
Describe the bug
if you write
export { default } from ...
at script block in vue file, the result is:index.ts
index.vue
if you run
npm run dev
, the browser shows:if you run
npm run build
, the terminal shows:If I write a plugin to transform all
export {default} from ...
intoimport xxx from xxx; export default xxx
, then vite works corretcly.Or if I change the following source code about genScriptCode in plugin-vue/src/main.ts, just add a judgement condition, it also works corretcly.
It seems that the problem is in the @vitejs/plugin-vue, the above syntax is not considered in this plugin.
Reproduction
https://stackblitz.com/edit/vitejs-vite-d9ekar?file=src/components/HelloWorld.vue
System Info
Used Package Manager
npm
Logs
Validations
The text was updated successfully, but these errors were encountered: