withastro / astro

The web framework for content-driven websites. ⭐️ Star to support our work!
https://astro.build
Other
43.79k stars 2.28k forks source link

Updating to svelte@5.0.0-next.141 throws errors #11149

Open amit13k opened 1 month ago

amit13k commented 1 month ago

Astro Info

Astro                    v4.9.1
Node                     v18.20.3
System                   Linux (x64)
Package Manager          unknown
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

Updating to svelte@5.0.0-next.141 throws the following error,

✘ [ERROR] No matching export in "node_modules/svelte/src/internal/client/index.js" for import "add_snippet_symbol"

    node_modules/@astrojs/svelte/client-v5.js:2:9:
      2 │ import { add_snippet_symbol } from 'svelte/internal/client';

What's the expected result?

No errors

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-w4fbdg?file=package.json

Participation

und3fined commented 1 month ago

From next.134 can't access to svelte/internal/client (https://github.com/sveltejs/svelte/releases/tag/svelte%405.0.0-next.134)

Currently, i downgrade to next.133 and wait Astro fix it

mwc commented 1 month ago

Svelte checks whether the import path starts with 'svelte/internal', so it is possible to import from the file path to bypass error checking; or directly 'fake' the 'add_snippet_symbol' function, which merely adds a 'snippet' identifier to the function, but neither approach seems to be a long-term solution.

mateothegreat commented 3 weeks ago

Downgrading @astrojs/svelte to 4.0.4 and changing to static for output: "static" will get you up and running for now.

package.json:

{
  "name": "blog",
  "type": "module",
  "version": "0.0.1",
  "scripts": {
    "dev": "astro check --watch & astro dev",
    "start": "astro dev",
    "build": "astro check && astro build",
    "preview": "astro preview",
    "astro": "astro"
  },
  "dependencies": {
    "@astrojs/check": "^0.7.0",
    "@astrojs/mdx": "^3.0.1",
    "@astrojs/rss": "^4.0.6",
    "@astrojs/sitemap": "^3.1.5",
    "@astrojs/svelte": "^4.0.4",
    "@astrojs/tailwind": "^5.1.0",
    "@astrojs/vercel": "^7.6.0",
    "astro": "^4.9.2",
    "prettier-plugin-astro": "^0.14.0",
    "prettier-plugin-svelte": "^3.2.3",
    "prettier-plugin-tailwindcss": "^0.6.1",
    "svelte": "^5.0.0-next.148",
    "tailwindcss": "^3.4.3",
    "typescript": "^5.4.5"
  },
  "devDependencies": {
    "@sveltejs/vite-plugin-svelte": "^3.1.1",
    "prettier": "^3.2.5"
  }
}

astro.config.mjs:

import mdx from '@astrojs/mdx';
import sitemap from '@astrojs/sitemap';
import svelte from "@astrojs/svelte";
import tailwind from "@astrojs/tailwind";
import { defineConfig } from 'astro/config';

import vercel from '@astrojs/vercel/static';

export default defineConfig({
  site: 'https://matthewdavis.io',
  integrations: [mdx(), sitemap(), svelte(), tailwind()],
  output: "static",
  adapter: vercel()
});
azat-io commented 2 weeks ago

The same problem 😞

azat-io commented 2 weeks ago

I created PR to fix this issue: https://github.com/sveltejs/svelte/pull/12008

ShaitanLyss commented 4 days ago

This workaround doesn't work btw, it totally breaks the page.

nzoschke commented 1 day ago

As a temporary workaround an older version works with Astro... npm install --save-dev svelte@5.0.0-next.133