-
-
Notifications
You must be signed in to change notification settings - Fork 227
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
Popup HTML auto refresh does not work with Vite 6.0.9+ #1360
Comments
Thanks for the report, will get this fixed. Not sure why I didn't use the HMR API for this originally lol. For my reference, custom events using server.ws.send({
type: 'custom',
event: 'special-update',
data: {}
}) if (import.meta.hot) {
import.meta.hot.on('special-update', (data) => {
// perform custom update
})
} |
Hmm, yeah, so this doesn't work because |
Maybe you can build it as an ES Module and dynamically import it from a classic script? |
Yeah, dynamic importing from the dev server might work. Will give it a go in a bit. |
Nope, that only works for ESM background scripts. Gonna have to stick with connecting to the websocket manually. |
Describe the bug
Due to a security issue (GHSA-vg6x-rcgg-rjx6), Vite 6.0.9+ now requires a token to connect to the WebSocket endpoint.
Because WXT connects to the WS server on its own, this connection no longer successes.
wxt/packages/wxt/src/sandbox/dev-server-websocket.ts
Lines 43 to 46 in 7c18d9c
The way to fix would be to pass
config.webSocketToken
as a query param (e.g.?token=${config.webSocketToken}
) when connecting to WS server.https://github.com/vitejs/vite/blob/9654348258eaa0883171533a2b74b4e2825f5fb6/packages/vite/src/node/config.ts#L610-L620
But ideally, it should not connect to the WebSocket server on its own and instead use
import.meta.hot
.Reproduction
pnpm dlx wxt@latest init
Steps to reproduce
pnpm dlx wxt@latest init
pnpm dev
entrypoints/popup/index.html
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: