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

PWA build with InjectManifest is broken #17745

Closed
bergmorten opened this issue Jan 9, 2025 · 3 comments
Closed

PWA build with InjectManifest is broken #17745

bergmorten opened this issue Jan 9, 2025 · 3 comments
Labels
bug/1-repro-available A reproduction is available and needs to be confirmed. flavour/quasar-cli-webpack kind/bug 🐞 mode/pwa Qv2 🔝 Quasar v2 issues

Comments

@bergmorten
Copy link

What happened?

I use @quasar/app-webpack with a vanila quasar project. Initialized with quasar cli and selected webpack. Then I added PWA mode and changed quasar.conf.ts to have workboxMode: 'InjectManifest'.

When building for PWA the sw.js files has require statements which is not supported and points to files that does not exits. It seems that the Esbuild setup does not have bundle mode enabled?

I also tried to set bundle mode true in extendPWACustomSWConf, but this did not have any effect?

    pwa: {
      workboxMode: 'InjectManifest', // 'GenerateSW' or 'InjectManifest'
      // swFilename: 'sw.js',
      // manifestFilename: 'manifest.json',
      // extendManifestJson (json) {},
      // useCredentialsForManifestTag: true,
      // injectPwaMetaTags: false,
      extendPWACustomSWConf(esbuildConf) {
        esbuildConf.bundle = true
      },
      // extendGenerateSWOptions (cfg) {},
      // extendInjectManifestOptions (cfg) {}
    },

What did you expect to happen?

The sw.js file genrated should be bundled with all imports and should not use require statements.

Reproduction URL

https://codepen.io/rstoenescu/pen/xxEvBLR

How to reproduce?

  1. Init a new quasar project , when asked select webpack mode v4
  2. Add mode pwa
  3. Change workboxMode to 'InjectManifest' in quasar.conf.ts
  4. quasar build -m pwa
  5. View generated sw.js file or test quasar serve in dist/pwa and open http://localhost:4000 (console error should state that require is not supported).

Flavour

Quasar CLI with Webpack (@quasar/cli | @quasar/app-webpack)

Areas

PWA Mode

Platforms/Browsers

No response

Quasar info output

No response

Relevant log output

No response

Additional context

No response

@bergmorten bergmorten added kind/bug 🐞 Qv2 🔝 Quasar v2 issues labels Jan 9, 2025
@github-actions github-actions bot added bug/1-repro-available A reproduction is available and needs to be confirmed. flavour/quasar-cli-webpack mode/pwa labels Jan 9, 2025
rstoenescu added a commit that referenced this issue Jan 11, 2025
@rstoenescu
Copy link
Member

Fix will be available in q/app-webpack v4.0.6.
Until the release, edit quasar.config file:

pwa: {
  extendInjectManifestOptions (cfg) {
    cfg.compileSrc = false
  }
}

@rstoenescu
Copy link
Member

Released it. Please remember to remove any of your previous quasar.config settings that you tried when reporting this bug.

@bergmorten
Copy link
Author

Thanks, I can confirm that the PWA build does work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/1-repro-available A reproduction is available and needs to be confirmed. flavour/quasar-cli-webpack kind/bug 🐞 mode/pwa Qv2 🔝 Quasar v2 issues
Projects
None yet
Development

No branches or pull requests

2 participants