Skip to content

With --modern build, the service-worker.js for the legcy build gets overwritten (when using PWA) #4616

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

Open
ptandler opened this issue Sep 25, 2019 · 1 comment

Comments

@ptandler
Copy link

Version

3.11.0

Environment info

  System:
    OS: Windows 7
    CPU: (4) x64 Intel(R) Core(TM) i5-2450M CPU @ 2.50GHz
  Binaries:
    Node: 10.16.3 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.17.3 - C:\Program Files\nodejs\yarn.CMD
    npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
  npmPackages:
    @fortawesome/vue-fontawesome: ^0.1.6 => 0.1.6
    @types/vue2-hammer:  undefined ()
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0
    @vue/babel-plugin-transform-vue-jsx:  1.0.0
    @vue/babel-preset-app:  3.10.0
    @vue/babel-preset-jsx:  1.1.0
    @vue/babel-sugar-functional-vue:  1.0.0
    @vue/babel-sugar-inject-h:  1.0.0
    @vue/babel-sugar-v-model:  1.0.0
    @vue/babel-sugar-v-on:  1.1.0
    @vue/cli-overlay:  3.10.0
    @vue/cli-plugin-babel: ^3.9.2 => 3.10.0
    @vue/cli-plugin-pwa: ^3.9.0 => 3.10.0
    @vue/cli-plugin-typescript: ^3.9.0 => 3.10.0
    @vue/cli-service: ^3.9.3 => 3.10.0
    @vue/cli-shared-utils:  3.10.0
    @vue/component-compiler-utils:  2.6.0 (3.0.0)
    @vue/preload-webpack-plugin:  1.1.1
    @vue/web-component-wrapper:  1.2.0
    bootstrap-vue: ^2.0.0-rc.27 => 2.0.0-rc.28
    portal-vue:  2.1.6
    svg-to-vue:  0.4.0
    typescript: ^3.5.3 => 3.5.3
    vue: ^2.6.10 => 2.6.10
    vue-class-component: ^7.1.0 => 7.1.0
    vue-cli-webpack:  1.0.0
    vue-functional-data-merge:  3.1.0
    vue-hot-reload-api:  2.3.3
    vue-loader:  15.7.1
    vue-property-decorator: ^8.2.1 => 8.2.1
    vue-router: ^3.0.7 => 3.1.2
    vue-style-loader:  4.1.2
    vue-svg-loader: ^0.12.0 => 0.12.0
    vue-template-compiler: ^2.6.10 => 2.6.10
    vue-template-es2015-compiler:  1.9.1
    vue2-hammer: ^2.1.2 => 2.1.2
  npmGlobalPackages:
    @vue/cli: Not Found

Steps to reproduce

Run vue-cli-service build --modern on any project that uses the PWA plugin (I guess), e.g. https://github.com/ptandler/enneagram-explorer

What is expected?

Actually I'm not sure if there are legacy browsers around that actually support service-workers.

If yes: then the service-worker.js should not be overwritten.

If no, then the service-worker.js should not be generated for the legacy build (or the legacy's precache-manifest should be removed).

What is actually happening?

When looking at the build console output, you see that service-worker.js is generated twice, but the modern version overwrites the legacy version

"C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\yarn\bin\yarn.js" run build
yarn run v1.17.3
$ vue-cli-service build --modern

\  Building legacy bundle for production...Starting type checking and linting service...
[...]
  File                                      Size             Gzipped

  docs\js\chunk-vendors-legacy.395a3bc0.    519.38 KiB       146.06 KiB
  js
  docs\js\app-legacy.eae3bd5c.js            84.41 KiB        16.89 KiB
**docs\service-worker.js**                    0.95 KiB         0.54 KiB 
  docs\precache-manifest.95c41e38370b2a3    0.37 KiB         0.22 KiB
  083d5f01432fab8b5.js
  docs\css\app.d418b07d.css                 218.38 KiB       30.85 KiB

-  Building modern bundle for production...Starting type checking and linting service...
[...]
  File                                      Size             Gzipped

  docs\js\chunk-vendors.4306b1ac.js         489.21 KiB       134.63 KiB
  docs\js\app.ad45478d.js                   82.37 KiB        16.59 KiB
**docs\service-worker.js**                    0.95 KiB         0.54 KiB
  docs\precache-manifest.85d7558efdc80c5    0.53 KiB         0.27 KiB
  449958e219a5e5d50.js
  docs\css\app.d418b07d.css                 218.38 KiB       30.85 KiB

 DONE  Build complete. The docs directory is ready to be deployed.

I noticed that there were always two versions of the precache-manifest generated I first I thought that the old one just doesn't get deleted.

@ptandler
Copy link
Author

Not sure if this could be related to #2397

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

No branches or pull requests

1 participant