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

Looking for Feature Like importScripts but For Static Results Outside of Webpack #151

Open
2 of 3 tasks
ava-cassiopeia opened this issue May 1, 2018 · 2 comments
Open
2 of 3 tasks

Comments

@ava-cassiopeia
Copy link

ava-cassiopeia commented May 1, 2018

  • I'm submitting a bug report
  • I'm submitting a feature request
  • I'm submitting a support request

webpack version:
4.5.0

sw-precache-webpack-plugin version:
0.11.5

Please tell us about your environment:
OSX 10.x

Browser: Chrome 66

Current behavior:

There is no way (that I know of) to do something like importScripts but for static HTML pages that are not a part of the Webpack build.

Expected/desired behavior:

Some sort of option for importScripts but it's just importStatic or similar so that the service worker will cache static pages of HTML.

Example:

const swGenerator = new SWPrecacheWebpackPlugin({
    /* ... */
    importStatic: ["/", "/foo", "/bar"]
});

☝🏻That would cause the service worker to cache the HTML present in the result of those URLs.

Additional context:

I'm using Laravel + Vue.js, so the Laravel bits are responsible for certain URLs returning certain HTML, so webpack doesn't know about any of the files being outputted because it's dynamically generated and served by Laravel. Maybe I'm just holding it wrong for this plugin, but I can't find a way to get it to generate a service worker file that includes certain, arbitrary URLs to be precached as well.

@ddykhoff
Copy link

I think you are looking for staticFileGlobs, which you'll want to use in conjunction with mergeStaticsConfig: true.

@kimown
Copy link

kimown commented Jan 24, 2019

I think you maybe use runtimeCaching

#137 (comment)

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

3 participants