beyonk-group / svelte-mapbox

MapBox Map and Autocomplete components for Svelte (or Vanilla JS)
MIT License
346 stars 61 forks source link

SvelteKit build fails due to peer dependency issues with Svelte v4 #90

Open StephenGunn opened 1 year ago

StephenGunn commented 1 year ago

With the new Svelte 4 release, trying to build my SvelteKit project fails due to the peer svelte@"^3.0.0" dependency in Svelte-mapbox.

Just messing with it in dev, I don't have any issues using Svelte 4 with the current version of Svelte-mapbox.

I don't know what testing you would want to do before bumping that number up to include Svelte 4, or I would just submit a pull request to fix it.

Thank you for the great package, I use it in multiple sites with great success.

The full error on Cloudflare Pages:

12:30:43.619 | npm ERR! Found: svelte@4.0.0
12:30:43.619 | npm ERR! node_modules/svelte
12:30:43.619 | npm ERR!   dev svelte@"^4.0.0" from the root project
12:30:43.619 | npm ERR!
12:30:43.619 | npm ERR! Could not resolve dependency:
12:30:43.620 | npm ERR! peer svelte@"^3.0.0" from @beyonk/svelte-mapbox@9.1.0
12:30:43.620 | npm ERR! node_modules/@beyonk/svelte-mapbox
12:30:43.620 | npm ERR!   dev @beyonk/svelte-mapbox@"^9.1.0" from the root project
12:30:43.620 | npm ERR!
12:30:43.620 | npm ERR! Fix the upstream dependency conflict, or retry
12:30:43.620 | npm ERR! this command with --force, or --legacy-peer-deps

adding --force to the build command does not fix the problem.

nk9 commented 1 year ago

Just tried installing svelte-mapbox and ran into the same error. Think this will be affecting most potential new users at this point.

StephenGunn commented 1 year ago

I opened a pull request to add svelte 4 compatibility.

I know Antony is a busy guy so I published a temp package that fixes the compatibility: https://www.npmjs.com/package/svelte-mapbox-4-temp

I will delete my temp package once compatibility on this repo gets added.

brendanmatkin commented 1 year ago

I'm using pnpm - it gives a warning but still works fine.

Not a real solution but an alternate work around if you need to make it work!

nk9 commented 11 months ago

Tagging @antony for visibility. This project is broken on the current release of Svelte.

codeforfunzz commented 9 months ago

in your project, edit package.json like this:

"devDependencies": {
...
"@beyonk/svelte-mapbox": "^9.1.0",
...
},
 "overrides": {
    "@beyonk/svelte-mapbox": {
      "svelte": "$svelte"
    }
  }
nk9 commented 5 months ago

Peer deps have been updated with this commit: https://github.com/beyonk-group/svelte-mapbox/commit/1e2edf81c6bb237175129f3db3bfea787ed708ca

Is this bug fixed?

antony commented 3 weeks ago

Will be fixed in the next release.