-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Basic sveltekit app with workers fails to finish build (hangs right after success message) #9528
Comments
I'm experiencing the same problem in a fresh repo. Directly Imported Worker - Build HangsIf you attempt to import a worker using the
Retrieve Worker as URL - Inlined w/ Wrong MIME TypeAlternatively, if you attempt to import a worker using the
So no matter which approach you take, there's no way to create an operational build with a Web Worker using SvelteKit currently. This use to be operational. |
Can confirm this is also happening to our project. I'm unsure when this started happening. It only started for me after deleting Could be related to this: vitejs/vite#10057 Edit: It also happens with static imports unfortunately |
I am having almost the exact same problem. The only difference is my build command fails entirely rather than hanging. I get the same Currently trying like hell to find a workaround. I have the same issue as the original with
|
@GavinSiver in version 1.15.0 the build no longer hangs but throws an error. |
The error is occurring because the SvelteKit 1.15.0 Reproduction: I'm unaware of any workarounds or ways to fix the issue. Web Workers with SvelteKit are currently broken and unusable. |
This appears to be a Vite issue, highlighted in the two issues below... Vite Issue 10190 I haven't verified, but there appears to be a fix on the way: |
In the meantime, adding this to the const config = {
// ...
// TODO: Remove once vite 4.3 is out
worker: {
plugins: [
{
name: 'remove-manifest',
configResolved(c) {
const manifestPlugin = c.worker.plugins.findIndex((p) => p.name === 'vite:manifest');
c.worker.plugins.splice(manifestPlugin, 1);
const ssrManifestPlugin = c.worker.plugins.findIndex(
(p) => p.name === 'vite:ssr-manifest'
);
c.plugins.splice(ssrManifestPlugin, 1);
}
}
]
}
};
// .. |
I can confirm the workaround works in my project with the same problem. Thanks @dummdidumm |
Thank you, dummdidumm! |
Vite 4.3-beta.2 has also been released with the fix above. There's also a ton of performance improvements in the release so would be good to bump as soon as possible too. |
There's currently a bug in Vite which prevents workers from being imported properly. See: sveltejs/kit#9528
Upgrading to vite 4.3.1 fixed the issue for me |
Closing as fixed as it's a Vite issue. |
Describe the bug
Sveltekit app with workers fails to build.
npm run dev
works.The build starts running and shows the
The emitted file "vite-manifest.json" overwrites a previously emitted file of the same name.
. Continues and even shows success message✓ built in XYms
, but immediatelly hangs after it. The process will not quit.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
Additional Information
No response
The text was updated successfully, but these errors were encountered: