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

Svelte integration with Svelte 5 is unusable since [email protected] #10637

Closed
1 task
xiBread opened this issue Apr 1, 2024 · 4 comments · Fixed by #10645
Closed
1 task

Svelte integration with Svelte 5 is unusable since [email protected] #10637

xiBread opened this issue Apr 1, 2024 · 4 comments · Fixed by #10645
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) good first issue Good for newcomers. If you need additional guidance, feel free to post in #dev on Discord pkg: svelte Related to Svelte (scope)

Comments

@xiBread
Copy link
Contributor

xiBread commented Apr 1, 2024

Astro Info

Astro                    v4.5.12
Node                     v21.7.1
System                   macOS (arm64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             @astrojs/svelte

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

Svelte 5 has removed the ability to directly import from the internal module, which the svelte integration relies on, and now throws:

Screenshot 2024-04-01 at 2 55 35 PM

On next.88 (sveltejs/svelte#10968)

Screenshot 2024-04-01 at 2 56 17 PM

On next.90 (sveltejs/svelte#10987)

The exports have moved to internal/client and internal/server in v5.

What's the expected result?

No error

Link to Minimal Reproducible Example

https://stackblitz.com/github/withastro/astro/tree/latest/examples/minimal?file=README.md

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Apr 1, 2024
@xiBread xiBread changed the title Svelte integration for Svelte 5 is unusable since [email protected] Svelte integration with Svelte 5 is unusable since [email protected] Apr 1, 2024
@bluwy
Copy link
Member

bluwy commented Apr 2, 2024

Should be fixed upstream: sveltejs/svelte#10979

@bluwy bluwy closed this as not planned Won't fix, can't repro, duplicate, stale Apr 2, 2024
@xiBread
Copy link
Contributor Author

xiBread commented Apr 2, 2024

That was fixed but next.90 introduced a new error because the specifier was only added to avoid Vite throwing on startup. The actual module does not export anything anymore. Please see the second screenshot.

@bluwy bluwy reopened this Apr 2, 2024
@bluwy
Copy link
Member

bluwy commented Apr 2, 2024

Seems like we need to use the new entrypoints now:

import { add_snippet_symbol } from 'svelte/internal';

import { add_snippet_symbol } from 'svelte/internal';

(/internal/server and /internal/client respectively)

and bump the peer dep to next.90

@bluwy bluwy added pkg: svelte Related to Svelte (scope) - P3: minor bug An edge case that only affects very specific usage (priority) good first issue Good for newcomers. If you need additional guidance, feel free to post in #dev on Discord and removed needs triage Issue needs to be triaged labels Apr 2, 2024
@mingjunlu
Copy link
Contributor

mingjunlu commented Apr 2, 2024

UPDATE:

I did a bit of searching and found #9098 mentioning that @astrojs/svelte's devDependency svelte needs to be bumped as well when testing locally. After doing so, the error message went away 🥳


I changed those imports and bumped the peer dependency. When testing locally, although the original error message went away, another error message showed up:

src/components/Counter.svelte (2:9): Error when using sourcemap for reporting an error: Can't resolve original location of error.
20:14:36 [ERROR] [vite] x Build failed in 251ms
src/components/Counter.svelte (2:9): "create_ssr_component" is not exported by "node_modules/svelte/src/internal/index.js", imported by "src/components/Counter.svelte".
file: /Downloads/jvminvvrg.github/src/components/Counter.svelte:2:9
1: /* src/components/Counter.svelte generated by Svelte v4.2.12 */
2: import { create_ssr_component, escape } from "svelte/internal";
            ^
3: 
4: const css = {
  Stack trace:
    at getRollupError (file:///Developer/astro/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/parseAst.js:376:41)
    at Module.error (file:///Developer/astro/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:13654:16)
    at ModuleScope.findVariable (file:///Developer/astro/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:11805:39)
    at CallExpression.bind (file:///Developer/astro/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:4735:23)
    at VariableDeclarator.bind (file:///Developer/astro/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:4735:23)

Is there anything I need to pay attention to when testing locally?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) good first issue Good for newcomers. If you need additional guidance, feel free to post in #dev on Discord pkg: svelte Related to Svelte (scope)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants