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

Add support for contenthash for b2share-bundle.js building #1837

Open
hjhsalo opened this issue Feb 15, 2021 · 1 comment
Open

Add support for contenthash for b2share-bundle.js building #1837

hjhsalo opened this issue Feb 15, 2021 · 1 comment

Comments

@hjhsalo
Copy link
Member

hjhsalo commented Feb 15, 2021

  1. Use webpack 'contenthash' -variable to add id-number to b2share-bundle.js and b2share-bundle.js.map files during webpack build.
  2. Use webpack to inject b2share-bundle-<CONTENTHASH>.js dynamically to index.html (
    <script src="/b2share-bundle.js"></script>
    )

html-webpack-plugin -webpack module could be used for 2.
It supports lodash templating out-of-the-box.

v.3.2.0 seems to be the last compatible version with webpack v1 which we still use: https://github.com/jantimon/html-webpack-plugin/blob/master/CHANGELOG.md#400-2020-03-23 --> "Dropped support for Webpack 1 - 3".

See this and this for more info on templating index.html with html-webpack-plugin.

@hjhsalo
Copy link
Member Author

hjhsalo commented Feb 15, 2021

This probably would help with cache invalidation problems, where clients (i.e. browsers) won't fetch a new copy of b2share-bundle.js after webpack build.

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