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

Snippet export causes dev script to fail #15347

Open
jerrythomas opened this issue Feb 20, 2025 · 2 comments
Open

Snippet export causes dev script to fail #15347

jerrythomas opened this issue Feb 20, 2025 · 2 comments
Labels
awaiting submitter needs a reproduction, or clarification

Comments

@jerrythomas
Copy link

Describe the bug

bun run dev

$ vite dev
5:10:38 PM [vite] (client) Forced re-optimization of dependencies

  VITE v6.1.1  ready in 250 ms

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
  ➜  press h + enter to show help
Error:   Failed to scan for dependencies from entries:
  /Users/Jerry/Developer/Labs/sk-snippet/src/routes/+page.svelte

  ✘ [ERROR] "listItems" is not declared in this file

    script:/Users/Jerry/Developer/Labs/sk-snippet/src/lib/ListItems.svelte?id=0:2:11:
      2 │   export { listItems };~~~~~~~~~


    at failureErrorWithLog (/Users/Jerry/Developer/Labs/sk-snippet/node_modules/esbuild/lib/main.js:1476:15)
    at /Users/Jerry/Developer/Labs/sk-snippet/node_modules/esbuild/lib/main.js:945:25
    at runOnEndCallbacks (/Users/Jerry/Developer/Labs/sk-snippet/node_modules/esbuild/lib/main.js:1316:45)
    at buildResponseToResult (/Users/Jerry/Developer/Labs/sk-snippet/node_modules/esbuild/lib/main.js:943:7)
    at /Users/Jerry/Developer/Labs/sk-snippet/node_modules/esbuild/lib/main.js:955:9
    at new Promise (<anonymous>)
    at requestCallbacks.on-end (/Users/Jerry/Developer/Labs/sk-snippet/node_modules/esbuild/lib/main.js:954:54)
    at handleRequest (/Users/Jerry/Developer/Labs/sk-snippet/node_modules/esbuild/lib/main.js:647:17)
    at handleIncomingPacket (/Users/Jerry/Developer/Labs/sk-snippet/node_modules/esbuild/lib/main.js:672:7)
    at Socket.readFromStdout (/Users/Jerry/Developer/Labs/sk-snippet/node_modules/esbuild/lib/main.js:600:7)
bun run build
$ vite build
vite v6.1.1 building SSR bundle for production...
✓ 158 modules transformed.
vite v6.1.1 building for production...
✓ 135 modules transformed.
.svelte-kit/output/client/_app/version.json                        0.03 kB │ gzip:  0.05 kB
.svelte-kit/output/client/.vite/manifest.json                      2.91 kB │ gzip:  0.56 kB
.svelte-kit/output/client/_app/immutable/chunks/D0gPaxp9.js        0.03 kB │ gzip:  0.05 kB
.svelte-kit/output/client/_app/immutable/entry/start.CfSTwjUw.js   0.06 kB │ gzip:  0.08 kB
.svelte-kit/output/client/_app/immutable/chunks/DyqcDmWL.js        0.32 kB │ gzip:  0.25 kB
.svelte-kit/output/client/_app/immutable/nodes/0.e8bPOg00.js       0.33 kB │ gzip:  0.24 kB
.svelte-kit/output/client/_app/immutable/chunks/CEAgSoVa.js        0.99 kB │ gzip:  0.56 kB
.svelte-kit/output/client/_app/immutable/nodes/1.BBLo2Zc1.js       1.06 kB │ gzip:  0.61 kB
.svelte-kit/output/client/_app/immutable/chunks/SWgnAoEH.js        2.48 kB │ gzip:  1.36 kB
.svelte-kit/output/client/_app/immutable/chunks/BgrhOOmg.js        3.10 kB │ gzip:  1.47 kB
.svelte-kit/output/client/_app/immutable/nodes/2.BDqgpbH2.js       3.18 kB │ gzip:  1.65 kB
.svelte-kit/output/client/_app/immutable/entry/app.BQLo7ahP.js     6.34 kB │ gzip:  2.98 kB
.svelte-kit/output/client/_app/immutable/chunks/B4LphI0t.js       12.57 kB │ gzip:  5.18 kB
.svelte-kit/output/client/_app/immutable/chunks/CRa4OZW5.js       32.03 kB │ gzip: 12.48 kB
✓ built in 166ms
.svelte-kit/output/server/.vite/manifest.json                   1.93 kB
.svelte-kit/output/server/entries/fallbacks/layout.svelte.js    0.17 kB
.svelte-kit/output/server/internal.js                           0.31 kB
.svelte-kit/output/server/chunks/escaping.js                    0.48 kB
.svelte-kit/output/server/chunks/equality.js                    0.67 kB
.svelte-kit/output/server/entries/pages/_page.svelte.js         0.81 kB
.svelte-kit/output/server/entries/fallbacks/error.svelte.js     1.52 kB
.svelte-kit/output/server/chunks/index.js                       3.06 kB
.svelte-kit/output/server/chunks/exports.js                     6.89 kB
.svelte-kit/output/server/chunks/internal.js                   42.79 kB
.svelte-kit/output/server/index.js                            100.35 kB
✓ built in 465ms

Run npm run preview to preview your production build locally.

> Using @sveltejs/adapter-auto
  Could not detect a supported production environment. See https://svelte.dev/docs/kit/adapters to learn how to configure your app to run on the platform of your choosing
  ✔ done

A subsequent bun run dev works.

Reproduction

How to replicate

git clone git@github.com:jerrythomas/issue-sk-snippet.git
bun i
bun run dev

Playground

The same code works on the playground

https://svelte.dev/playground/9f2ce709c92c451c98221568e8aeaf4e?version=5.20.2

Build works

This runs without errors too!

bun i
bun run build

Logs

System Info

System:
    OS: macOS 15.3.1
    CPU: (16) arm64 Apple M4 Max
    Memory: 614.81 MB / 48.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 23.4.0 - ~/.nvm/versions/node/v23.4.0/bin/node
    npm: 10.9.2 - ~/.nvm/versions/node/v23.4.0/bin/npm
    pnpm: 10.3.0 - /opt/homebrew/bin/pnpm
    bun: 1.2.2 - /opt/homebrew/bin/bun
  Browsers:
    Chrome: 133.0.6943.126
    Safari: 18.3
  npmPackages:
    svelte: ^5.0.0 => 5.20.2

Severity

annoyance

@jerrythomas
Copy link
Author

Even though in the reproduction, bun run dev works after the bun run build. However, in my repository I had the snippet in a separate library, and in that repo, bun run build did not solve the bun run dev issue.

I will try to see if I can reproduce the scenario.

@Conduitry
Copy link
Member

Does the issue appear with Node? If so, please provide a reproduction using that. Bun has a lot of issues due to incomplete/buggy Node compatibility.

@Conduitry Conduitry added the awaiting submitter needs a reproduction, or clarification label Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting submitter needs a reproduction, or clarification
Projects
None yet
Development

No branches or pull requests

2 participants