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

fix: hmr on web worker #6483

Closed

Conversation

userquin
Copy link
Contributor

@userquin userquin commented Jan 13, 2022

Description

Fix client and overlay modules for HMR on web workers.

This PR will be on draft since I need to add some test and what to do on clearErrorOverlay, line 200 of client.ts.

I just push it if anyone can review the changes on packages/vite/src/client.

I've included on worker playground 2 examples to update msg from workerImport module, also modified the index.html page to log HMR updates for my-worker (normal and inlined), possible-ts-output-worker and workerImport to avoid full reload.

Here you can check the HMR working with playground web workers: https://streamable.com/0gtb8d

closes #25
closes #5396

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@userquin
Copy link
Contributor Author

userquin commented Jan 13, 2022

We cannot use HMR on service workers since we cannot use dynamic imports yet on service workers.

@userquin
Copy link
Contributor Author

userquin commented Jan 13, 2022

I need to add tsconfig.json on workers playground to add "module": "esnext", maybe we need to review it since I can break tests.

@userquin
Copy link
Contributor Author

userquin commented Jan 13, 2022

Tested also on vue project to check it is not breaking anything (I cannot run vue playground, it is failing, see last screenshot):

imagen

The error on vue playground:

imagen

@userquin
Copy link
Contributor Author

superseded by #10262

@userquin userquin closed this Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HMR on service worker
2 participants