Open martinszeltins opened 2 years ago
I think you should be very close to the reason, you already know clearly that the third step caused the compilation failure, the error message clearly states The package may have incorrect main/module/exports specified in its package.json.
Due to changes in App.vue
, the file compilation fails so that there is no correct export information to main.js, so that the entire build fails.
I think you should be very close to the reason, you already know clearly that the third step caused the compilation failure, the error message clearly states
The package may have incorrect main/module/exports specified in its package.json.
Due to changes inApp.vue
, the file compilation fails so that there is no correct export information to main.js, so that the entire build fails.
I found the source of the problem only after hours of debugging because the error message was not helpful. It would be better to fix this bug or at least provide a more useful error message.
@martinszeltins so what's your solution to the problem?
@martinszeltins so what's your solution to the problem?
If I remember correctly, it was the /
in src of the img:
<img src="/" class="logo" alt="Vite logo" />
@martinszeltins thanks for a quick reply! In my case the error says:
[commonjs--resolver] Failed to resolve entry for package "date-fns". The package may have incorrect main/module/exports specified in its package.json.
It started happening out of nowhere. No changes in package.json nor in yarn.lock. The issue happens only in a CI environment, which is weird because the packages are installed with --frozen-lockfile
option there. Perhaps you have some clue on how to debug this issue?
Alright I found out that the issue was caused by caching mechanism on GitLab, without it the project builds as expected. I suspect it has something to do with symlinks to node_modules, because node_modules are now part of the .output directory (Nuxt3 project).
Describe the bug
I have spent half a day trying to figure out why my build fails. This error message did not tell me where in my code the problem was. The error message should be clearer and show where the error is.
Please follow the
Steps to reproduce
below.If I add a
<img src="/" />
the build fails. All I did was take the official vite vue template and replaced this line and the build fails:App.vue
Then if I run build I get this error::
Reproduction
https://stackblitz.com/edit/vue-zgunyo?file=src%2FApp.vue
Steps to reproduce
$ npm create vite@latest my-vue-app -- --template vue
$ cd my-vue-app && npm install
App.vue
and replace<img src="/vite.svg" class="logo" alt="Vite logo" />
with<img src="/" class="logo" alt="Vite logo" />
$ npm run build
And the build will fail with the error message I mentioned above.
System Info