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

ignore all .map files for service worker cache #3734

Merged
merged 3 commits into from
Oct 24, 2019
Merged

ignore all .map files for service worker cache #3734

merged 3 commits into from
Oct 24, 2019

Conversation

gibkigonzo
Copy link
Collaborator

@gibkigonzo gibkigonzo commented Oct 21, 2019

Short description and why it's useful

In service-worker webpack config there is regex which should filter .map files but It doesn't.
staticFileGlobsIgnorePatterns: [/\.map$/]
So we load for sw almost 2mb .map files in production

As I checked in node_modules/sw-precache-webpack-plugin/src/index.js this regex is used on current emited files and for staticFileGlobs.

    // merge assetGlobs with provided staticFileGlobs and filter using staticFileGlobsIgnorePatterns
    const staticFileGlobs = assetGlobs.concat(this.options.staticFileGlobs || []).filter(text =>
      (!staticFileGlobsIgnorePatterns.some((regex) => regex.test(text)))
    );

So if sw is compiled in separate webpack then we filter only core-service-worker.js.map (only one .map emitted for webpack.prod.sw.config.ts).
To fix this we can add more specific paths in staticFileGlobs.

      staticFileGlobs: [
        'dist/**.*.js',
        'dist/**.*.json',
        'dist/**.*.css',

QA

  1. open http://demo.storefrontcloud.io, clear cache and refresh page
  2. open Network tab in devtools and filter loaded files by typing .map
  3. checkout on current branch, prepare env (yarn build and yarn start)
  4. make 1 and 2 step on current branch page
  5. compare network payload

Which environment this relates to

Check your case. In case of any doubts please read about Release Cycle

  • Test version (https://test.storefrontcloud.io) - this is a new feature or improvement for Vue Storefront. I've created branch from develop branch and want to merge it back to develop
  • RC version (https://next.storefrontcloud.io) - this is a stabilisation fix for Release Candidate of Vue Storefront. I've created branch from release branch and want to merge it back to release
  • Stable version (https://demo.storefrontcloud.io) - this is an important fix for current stable version. I've created branch from hotfix or master branch and want to merge it back to hotfix

Upgrade Notes and Changelog

  • No upgrade steps required (100% backward compatibility and no breaking changes)
  • I've updated the Upgrade notes and Changelog on how to port existing VS sites with this new feature

IMPORTANT NOTICE - Remember to update CHANGELOG.md with description of your change

Contribution and currently important rules acceptance

@andrzejewsky andrzejewsky added this to the 1.11.0-rc2 milestone Oct 21, 2019
@alinadivante alinadivante added the QA approved on branch Testers will add this label after positive check on specific branch. label Oct 23, 2019
@pkarw pkarw merged commit dfc3d10 into vuestorefront:release/v1.11 Oct 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
QA approved on branch Testers will add this label after positive check on specific branch.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants