We stop using @types for all webpack related modules. Webpack ^5 implicitly has all the stuff, so we no longer require @types/dotenv-webpack, @types/webpack-bundle-analyzer, @types/webpack-dev-server.
We also remove assets-webpack-plugin (which was previously responsible for generating webpack.json)
We now use webpack-manifest-plugin to generate webpack.json instead. This is done to have key-value pairs from unhashed file name to hashed file name.
In particular, we hash 3 more things now: fonts, images and mathjax. Other stuff like css or js is already hashed in production. (Source: webpack.common.ts)
We then use hashed static assets in partials through webpack's key-value pairs. Source: get_asset_webpack_url.html
How can this be tested?
Because of the nature of changes involved (manually modifying URL for all the static assets), we should make sure that there's no typo anywhere and the changes are working as expected.
Checkout to this branch
Test in online / offline themes (www and course). Check for major functionalities such as videojs, nanogallery2, check for JS functionalities, make sure all the static assets are working fine.
You can use this course perhaps: 16.885j-fall-2005 --> related resources (both nanogallery2 and videojs in 1 place).
What are the relevant tickets?
Partial solution to #1212
Description (What does it do?)
This PR does some
webpack
related modifications. This PR was made pertaining to the discussion we had for https://github.com/mitodl/ocw-hugo-themes/pull/1259#discussion_r1370219275These are the pointers:
@types
for all webpack related modules. Webpack ^5 implicitly has all the stuff, so we no longer require@types/dotenv-webpack
,@types/webpack-bundle-analyzer
,@types/webpack-dev-server
.assets-webpack-plugin
(which was previously responsible for generatingwebpack.json
)webpack-manifest-plugin
to generatewebpack.json
instead. This is done to have key-value pairs from unhashed file name to hashed file name.fonts
,images
andmathjax
. Other stuff likecss
orjs
is already hashed in production. (Source:webpack.common.ts
)webpack's
key-value pairs. Source:get_asset_webpack_url.html
How can this be tested?
Because of the nature of changes involved (manually modifying URL for all the static assets), we should make sure that there's no typo anywhere and the changes are working as expected.
Checkout to this branch Test in online / offline themes (
www
andcourse
). Check for major functionalities such asvideojs
,nanogallery2
, check for JS functionalities, make sure all the static assets are working fine. You can use this course perhaps:16.885j-fall-2005
--> related resources (both nanogallery2 and videojs in 1 place).