EUDAT-B2SHARE / b2share

B2SHARE software for the EUDAT CDI services.
https://b2share.eudat.eu
GNU General Public License v2.0
35 stars 33 forks source link

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

Open hjhsalo opened 3 years ago

hjhsalo commented 3 years ago
  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 (https://github.com/EUDAT-B2SHARE/b2share/blob/d846068c71853221ac53239c9efc56e3e795e6c3/webui/app/index.html#L97)

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 commented 3 years ago

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.