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

feat: add ESM support #319

Closed
wants to merge 2 commits into from
Closed

feat: add ESM support #319

wants to merge 2 commits into from

Conversation

userquin
Copy link
Member

@userquin userquin commented Jun 30, 2022

This PR also fixes the injectRegister on development: we have a race condition, it seem Vite will call the transform on dev before the virtual and so will always generate the registerSW.js.

I have added some hints on the docs: if not importing any virtual module and using dev the user MUST explicitly configure injectRegister with inline or script.

@netlify
Copy link

netlify bot commented Jun 30, 2022

Deploy Preview for vite-plugin-pwa ready!

Name Link
🔨 Latest commit 7b66c9e
🔍 Latest deploy log https://app.netlify.com/sites/vite-plugin-pwa/deploys/62be091a8b9b3100097ae06c
😎 Deploy Preview https://deploy-preview-319--vite-plugin-pwa.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@userquin
Copy link
Member Author

userquin commented Jun 30, 2022

I'll check this PR on vitesse, just some tests on local using type module and commonjs on an svelte project.

EDIT: also tested with all examples in the repo, generateSW and injectManifest with prompt for all frameworks.

EDIT2: vitesse working also with mode cjs and esm

@userquin userquin requested a review from antfu June 30, 2022 20:48
@userquin userquin marked this pull request as ready for review June 30, 2022 20:48
@userquin
Copy link
Member Author

@antfu On draft, I need to check the client types, can you check it on vscode?

@userquin userquin marked this pull request as draft June 30, 2022 21:37
@userquin
Copy link
Member Author

userquin commented Jul 2, 2022

I'll split this PR in 2 and so we can merge the fix for dev mode

@userquin
Copy link
Member Author

userquin commented Jul 7, 2022

supersed by #327

/cc @natemoo-re @benmccann

@userquin userquin closed this Jul 7, 2022
@userquin userquin deleted the userquin/feat-add-esm-support branch July 7, 2022 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants