sveltejs / svelte

Cybernetically enhanced web apps
https://svelte.dev
MIT License
78.36k stars 4.1k forks source link

Basic svetlekit app with workers fails to finish build #8415

Closed marianmeres closed 1 year ago

marianmeres commented 1 year ago

Describe the bug

Sveltekit app (npm create svelte@latest) with workers fails to build. npm run dev works. Example:

// $lib/worker/foo.ts
self.addEventListener('message', (message) => console.log(message.data));

// $lib/worker/foo-instance.ts
export const fooInstance = new Worker(new URL('./foo', import.meta.url));

// +page.svelte
<button on:click={async () => {
  const { fooInstance } = (await import("$lib/worker/foo-instance"));
  fooInstance.postMessage(Math.random());
}}>test worker</button>

The actual build runs, even shows success message, but eventually hangs after ✓ built in XYms.

Reproduction

https://github.com/marianmeres/_sveltekit-app-worker-bug https://stackblitz.com/edit/sveltejs-kit-template-default-wwv4gb

Logs

No response

System Info

System:
    OS: macOS 13.2.1
    CPU: (8) arm64 Apple M1
    Memory: 52.84 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 19.6.0 - /opt/homebrew/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 9.4.0 - /opt/homebrew/bin/npm
  Browsers:
    Brave Browser: 111.1.49.128
    Chrome: 111.0.5563.110
    Firefox: 111.0.1
    Safari: 16.3
  npmPackages:
    svelte: ^3.56.0 => 3.57.0

Severity

blocking an upgrade

marianmeres commented 1 year ago

Just adding, that the build shows The emitted file "vite-manifest.json" overwrites a previously emitted file of the same name.

I have no idea how significant that is to the issue at hand.

marianmeres commented 1 year ago

I realized that sveltejs/kit is more suitable place for this report, so I'm moving it there: https://github.com/sveltejs/kit/issues/9528