wxt: Svelte error: mount() not available on the server
Describe the bug
When creating a wxt project with svelte, the following error occurs in console:
Uncaught Svelte error: lifecycle_function_unavailable
`mount(...)` is not available on the server
This error was discussed in #1228 and should (as of my understanding) be fixed by using @wxt-dev/module-svelte@2.0.1.
Reproduction
Steps to reproduce
Run pnpm dlx wxt@latest init, follow the setup and select svelte.
Then cd into the project and replace @wxt-dev/module-svelte: ^2.0.0 with @wxt-dev/module-svelte: ^2.0.1.
Install dependencies: pnpm i.
Build and zip the extension: pnpm zip:firefox.
Visit about:debugging#/runtime/this-firefox and load temporary Add-on.
Click the Add-ons Icon in Add-on bar and check console in Add-on Inspector.
System Info
System:
OS: Linux 6.6 Manjaro Linux
CPU: (16) x64 AMD Ryzen 7 5800X3D 8-Core Processor
Memory: 25.36 GB / 31.27 GB
Container: Yes
Shell: 3.7.1 - /bin/fish
Binaries:
Node: 18.18.2 - ~/.nvm/versions/node/v18.18.2/bin/node
npm: 10.5.0 - ~/.local/share/pnpm/npm
pnpm: 9.15.0 - ~/.local/share/pnpm/pnpm
Browsers:
Chromium: 131.0.6778.108
npmPackages:
wxt: ^0.19.13 => 0.19.22
Used Package Manager
pnpm
Validations
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 21 (9 by maintainers)
I installed
it seems to be able to load Svelte now, both in the content script and popup page thanks a lot!
OK, I got a fix that works in both dev mode and production builds, without any warning logs:
working-example.zip
Will open a PR.