Skip to content

fix: avoid assigning to bundle object #843

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

Merged

Conversation

sapphi-red
Copy link
Contributor

Description

Assigning to bundle object is discouraged by rollup and is not supported by rolldown.

This PR changes the code using assignment to use this.emitFile instead. This would make vite-plugin-pwa work with Rolldown powered Vite.

If the plugin context is not passed to api.generateBundle, it will still use the previous method for backward compat.

Linked Issues

Additional Context


Tip

The author of this PR can publish a preview release by commenting /publish below.

Copy link

netlify bot commented Mar 25, 2025

Deploy Preview for vite-plugin-pwa-legacy ready!

Name Link
🔨 Latest commit 6ebab07
🔍 Latest deploy log https://app.netlify.com/sites/vite-plugin-pwa-legacy/deploys/67e4b506a2fc6b0008fe877b
😎 Deploy Preview https://deploy-preview-843--vite-plugin-pwa-legacy.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 configuration.

@userquin
Copy link
Member

Thx ❤️ , I need to include this in Vite 6 Env. Api pr

Copy link

pkg-pr-new bot commented Mar 25, 2025

npm i https://pkg.pr.new/vite-plugin-pwa@843

commit: 6ebab07

@userquin
Copy link
Member

I'm checking integrations with a local tgz from this PR:

  • SvelteKit: WIP
  • Nuxt: looks like I need to check it with latest Nuxt, using 3.10 seems to be not working, the web manifest not being generated in the dist folder, and so I need to use the api.generateBundle without the plugin context

I'm checking also if we need to add the emit for FILE_SW_REGISTER asset via plugin context, just a few lines below changes in the api module:

image

@sapphi-red
Copy link
Contributor Author

I'm checking also if we need to add the emit for FILE_SW_REGISTER asset via plugin context, just a few lines below changes in the api module:

Ah, yes, that should be changed as well. I'll update the PR.

@userquin
Copy link
Member

userquin commented Mar 28, 2025

@sapphi-red just a question about vite and rolldown: we've small problem importing stuff from rollup, we should import rollup types from vite, but OutputAsset used in the api.ts module here not being re-exported by vite 5.0.12 (we should also update src/types.ts), so using rolldown will require a breaking dropping support for older Vite versions. Do you have any hint about this?

NOTE: I don't want to change the imports here, it is fine, just doing final SvelteKit test...

imagen

Copy link
Member

@userquin userquin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx ❤️

@userquin userquin merged commit b07167f into vite-pwa:main Mar 29, 2025
6 checks passed
@sapphi-red sapphi-red deleted the fix/avoid-assigning-to-bundle-object branch March 31, 2025 04:33
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.

2 participants