Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use peer dependencies rather than dev dependencies #11433

Merged
merged 3 commits into from Jan 8, 2024

Conversation

Rich-Harris
Copy link
Member

Right now it's rather difficult to use Svelte 5 alongside a linked @sveltejs/kit, because Kit imports vite and @sveltejs/vite-plugin-svelte relative to itself, even though these are peer dependencies.

This means that components will be compiled by Svelte 4 (as that's what the @sveltejs/vite-plugin-svelte inside the linked @sveltejs/kit depends on), but then try to use the Svelte 5 runtime.

This is already a nuisance but it will become much more of one as Svelte 5 gets closer to release and we're trying to make sure everything works in both versions.

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Copy link

changeset-bot bot commented Dec 21, 2023

🦋 Changeset detected

Latest commit: 39e4fe5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@maximdeclercq
Copy link

maximdeclercq commented Jan 9, 2024

This PR makes use of import-meta-resolve, which is incompatible with Yarn PnP, resulting in the following error:

error when starting dev server:
Error: Cannot find package '@sveltejs/vite-plugin-svelte' imported from /work/my-app/dummy.js
    at __node_internal_ (file:///home/mdc/.yarn/berry/cache/import-meta-resolve-npm-4.0.0-13a6ef4fd3-10c0.zip/node_modules/import-meta-resolve/lib/errors.js:431:11)
    at new NodeError (file:///home/mdc/.yarn/berry/cache/import-meta-resolve-npm-4.0.0-13a6ef4fd3-10c0.zip/node_modules/import-meta-resolve/lib/errors.js:374:5)
    at packageResolve (file:///home/mdc/.yarn/berry/cache/import-meta-resolve-npm-4.0.0-13a6ef4fd3-10c0.zip/node_modules/import-meta-resolve/lib/resolve.js:1038:9)
    at moduleResolve (file:///home/mdc/.yarn/berry/cache/import-meta-resolve-npm-4.0.0-13a6ef4fd3-10c0.zip/node_modules/import-meta-resolve/lib/resolve.js:1101:20)
    at defaultResolve (file:///home/mdc/.yarn/berry/cache/import-meta-resolve-npm-4.0.0-13a6ef4fd3-10c0.zip/node_modules/import-meta-resolve/lib/resolve.js:1266:15)
    at Module.resolve (file:///home/mdc/.yarn/berry/cache/import-meta-resolve-npm-4.0.0-13a6ef4fd3-10c0.zip/node_modules/import-meta-resolve/index.js:32:12)
    at resolve_peer_dependency (file:///work/my-app/.yarn/unplugged/@sveltejs-kit-virtual-ff81c722c8/node_modules/@sveltejs/kit/src/exports/vite/index.js:132:29)
    at sveltekit (file:///work/my-app/.yarn/unplugged/@sveltejs-kit-virtual-ff81c722c8/node_modules/@sveltejs/kit/src/exports/vite/index.js:167:27)
    at async Promise.all (index 0)
    at async asyncFlatten (file:///work/my-app/.yarn/__virtual__/vite-virtual-ccd3afe941/4/.yarn/berry/cache/vite-npm-5.0.11-d5457a8b86-10c0.zip/node_modules/vite/dist/node/chunks/dep-V3BH7oO1.js:12894:16)
    at async resolveConfig (file:///work/my-app/.yarn/__virtual__/vite-virtual-ccd3afe941/4/.yarn/berry/cache/vite-npm-5.0.11-d5457a8b86-10c0.zip/node_modules/vite/dist/node/chunks/dep-V3BH7oO1.js:67863:29)
    at async _createServer (file:///work/my-app/.yarn/__virtual__/vite-virtual-ccd3afe941/4/.yarn/berry/cache/vite-npm-5.0.11-d5457a8b86-10c0.zip/node_modules/vite/dist/node/chunks/dep-V3BH7oO1.js:60327:20)
    at async CAC.<anonymous> (file:///work/my-app/.yarn/__virtual__/vite-virtual-ccd3afe941/4/.yarn/berry/cache/vite-npm-5.0.11-d5457a8b86-10c0.zip/node_modules/vite/dist/node/cli.js:764:24)

@Rich-Harris
Copy link
Member Author

Yarn PnP is broken, and we do not support it. Use npm or pnpm instead.

@maximdeclercq
Copy link

maximdeclercq commented Jan 10, 2024

Yarn PnP with Yarn 4 works on SvelteKit 2.0.7, but not on SvelteKit 2.0.8.
I have made an issue here #11578.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants