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

please include workbox over npm instead of downloading it over https #3361

Closed
yennor opened this issue Jan 23, 2019 · 2 comments · May be fixed by carlosrojaso/vue-cli#128
Closed

please include workbox over npm instead of downloading it over https #3361

yennor opened this issue Jan 23, 2019 · 2 comments · May be fixed by carlosrojaso/vue-cli#128

Comments

@yennor
Copy link

yennor commented Jan 23, 2019

What problem does this feature solve?

The service-worker.js generated by vue cli includes workbox over an https link:
"https://storage.googleapis.com/workbox-cdn/releases/3.6.3/workbox-sw.js".
One of the reasons I use npm is that I don't want the end application to download scripts from everywhere on the internet.
Additionally for me the above behaviour makes development more difficult, since it happens quite often that I'm developing without having an internet connection. So then above include obviously doesn't work.
So if workbox would be included as npm module, that would be great :-).

What does the proposed API look like?

The api wouldn't change.
Just add workbox-sw dependency to pwa plugin.

@LinusBorg
Copy link
Member

LinusBorg commented Jan 24, 2019

the workbox webpack plugin has an option for that, called importWorkboxFrom

module.exports = {
  pwa: {
    workboxOptions: {
      importWorkboxFrom: 'local',
    }
  }
}

If that solution doesn't suit you, try working out somehting with the 'disabled' version of this option.

We can't solve it in vue-cli because the workbox plugin relys on these settings to know where to fetch workbox from.

We also think that using a CDN for this is a reasonbable default.

@jbuhacoff
Copy link

Other javascript, css, font, and icon dependencies are downloaded using npm, and in production builds these other assets are compressed and copied into the dist directory. Most of them are also available on CDN but copying the assets to the local project is a good choice because it decouples the website/app from other people's CDNs, and the website/app owner can still put the output files on any CDN they choose.

Making importWorkboxFrom: 'local' the default would match the way the rest of the application is built.

There's also a good point being made at Issue #539 in vuepress about making the build output privacy-sensitive by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants