-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
Vite 6 PWA build doesn't seem to resolve the correct file #19087
Comments
I need to add integration: {
configureCustomSWViteBuild: inlineConfig => {
inlineConfig.resolve ??= {}
inlineConfig.resolve.conditions = ['browser', 'module']
},
}, |
Thank you, that solved that problem for me. Didn't realise that this was needed. I have another module, This package is slightly different, in that it has the
I'm not sure if this is a bug in the package itself, or if this should also just work? Log:
|
try using: integration: {
configureCustomSWViteBuild: inlineConfig => {
inlineConfig.resolve ??= {}
inlineConfig.resolve.alias ??= {}
inlineConfig.resolve.alias['pino'] = './node_modules/pino/browser.js'
inlineConfig.resolve.conditions = ['browser', 'module']
},
}, |
Yep, I'm aware I can manually force it to use the file. Should this not work out of the box? |
The custom sw build done via Vite |
Describe the bug
I've tried to upgrade from v5 to v6, but for some reason, the PWA build seems to not quite do what it did before.
This is the output for v6 in the repro repository
For v5:
From what I can tell, vite seems to be picking the node files instead for the browser files, despite the
package.json
forbroadcast-channel
having the following. The errors in the console I believe are related due to trying to use the incompatible node files instead of the browser version.Reproduction
https://github.com/jacquesg/sw-repro
Steps to reproduce
pnpm i && pnpm build && pnpm preview
Open
http://localhost:4173
The error console should show something like the following:
System Info
Used Package Manager
pnpm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: