error: No matching export in "App.vue" for import "default" caused by commented // export default {
Version
3.2.2
Reproduction link
https://github.com/mariusa/vue-import-error
Steps to reproduce
git clone git@github.com:mariusa/vue-import-error.git
cd vue-import-error/
npm i
npm run dev
What is expected?
start the app
What is actually happening?
> my-vue-app@0.0.0 dev /home/marius/work/misc/vue-import-error
> vite
> src/main.js:2:7: error: No matching export in "html:/home/marius/work/misc/vue-import-error/src/App.vue" for import "default"
2 │ import App from './App.vue'
╵ ~~~
error when starting dev server:
Error: Build failed with 1 error:
src/main.js:2:7: error: No matching export in "html:/home/marius/work/misc/vue-import-error/src/App.vue" for import "default"
at failureErrorWithLog (/home/marius/work/misc/vue-import-error/node_modules/esbuild/lib/main.js:1449:15)
at /home/marius/work/misc/vue-import-error/node_modules/esbuild/lib/main.js:1131:28
at runOnEndCallbacks (/home/marius/work/misc/vue-import-error/node_modules/esbuild/lib/main.js:921:63)
at buildResponseToResult (/home/marius/work/misc/vue-import-error/node_modules/esbuild/lib/main.js:1129:7)
at /home/marius/work/misc/vue-import-error/node_modules/esbuild/lib/main.js:1236:14
at /home/marius/work/misc/vue-import-error/node_modules/esbuild/lib/main.js:609:9
at handleIncomingPacket (/home/marius/work/misc/vue-import-error/node_modules/esbuild/lib/main.js:706:9)
at Socket.readFromStdout (/home/marius/work/misc/vue-import-error/node_modules/esbuild/lib/main.js:576:7)
at Socket.emit (events.js:315:20)
at Socket.EventEmitter.emit (domain.js:467:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-vue-app@0.0.0 dev: `vite`
npm ERR! Exit status 1
Removing the commented line
// export default {
solves this. But why does a comment cause it?
I have no idea what's exactly causing it but the error seems to come from vite and no error happens in the SFC playground. You should open an issue there instead. It's weird that removing it seems to solve it while still allowing to add it again without crashing.
It's weird that removing it seems to solve it while still allowing to add it again without crashing.
Took me a while to figure out: because of node_modules/.vite/ cache
Should have been fixed in vite: https://github.com/vitejs/vite/issues/4598