sveltejs / vite-plugin-svelte

Svelte plugin for http://vitejs.dev/
MIT License
864 stars 105 forks source link

Failed to resolve dependency vite #553

Closed vdawg-git closed 1 year ago

vdawg-git commented 1 year ago

Describe the bug

I cannot update vite-plugin-svelte. I do not quite understand why the dependencies conflict. The error message is not very clear to me.

I do have the plugin set to ^2.0.2 and Vite to ^4.0.1 (the latest versions)

Logs

code ERESOLVE
ERESOLVE could not resolve
npm ERR!
While resolving: my-app@undefined
Found: @sveltejs/vite-plugin-svelte@1.4.0
node_modules/@sveltejs/vite-plugin-svelte
  dev @sveltejs/vite-plugin-svelte@"^2.0.2" from the root project
npm ERR!
Could not resolve dependency:
dev @sveltejs/vite-plugin-svelte@"^2.0.2" from the root project
npm ERR!
Conflicting peer dependency: vite@4.0.1
node_modules/vite
  peer vite@"^4.0.0" from @sveltejs/vite-plugin-svelte@2.0.2
  node_modules/@sveltejs/vite-plugin-svelte
    dev @sveltejs/vite-plugin-svelte@"^2.0.2" from the root project
npm ERR!
Fix the upstream dependency conflict, or retry
this command with --force or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.

When I just try to force it I get this when bundling:

[plugin externalize-deps] Failed to resolve entry for package "@sveltejs/vite-plugin-svelte". The package may have incorrect main/module/exports specified in its package.json: No known conditions for "." entry in "@sveltejs/vite-plugin-svelte" package

System Info

Windows 11.
npm
dominikg commented 1 year ago

please make sure you have read the changelog and faq about changes in vite-plugin-svelte 2.0.

This issue is missing a reproduction url, which was one of the required fields when you opened it. Please provide one

vdawg-git commented 1 year ago

I deleted all svelte packages and reinstalled them one by one to figure out what was causing the problem. And this fixed the problem. So I think just deleting node_modules and reinstalling again is a quicker way to fix this.

Also setting type: "module makes it run (I should have read the changelog)