Skip to content

webpack 4 to 5#417

Merged
breville merged 12 commits intomainfrom
webpack-4-to-5
Mar 7, 2026
Merged

webpack 4 to 5#417
breville merged 12 commits intomainfrom
webpack-4-to-5

Conversation

@breville
Copy link
Member

@breville breville commented Mar 5, 2026

This upgrades webpack from 4 to 5, bringing this repo (AI for Oceans) in line with our main repo.

Amongst other changes, it converts the use of a couple loaders (url-loader and file-loader) to Asset Modules, as recommended by https://webpack.js.org/migrate/5/.

It makes some minor updates to linting and tests to at least keep them passing.

@breville breville requested review from a team and stephenliang March 5, 2026 13:38
.babelrc Outdated
Comment on lines +3 to +6
"plugins": [
"@babel/plugin-transform-object-rest-spread",
"@babel/plugin-transform-class-properties",
["@babel/plugin-transform-regenerator", {"async": true, "asyncGenerators": true}]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually wonder if these can be removed and just rely on the presets. Most of these are no longer needed in our official supported set and even our extended supported set of browsers.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. It looks to work without them.

"@fortawesome/free-solid-svg-icons": "^5.11.2",
"@fortawesome/react-fontawesome": "^0.1.7",
"messageformat": "^1.1.0",
"messageformat": "2.3.0",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the following error when running yarn in the main repo with a symlinked ml-activities:

Cannot link @code-dot-org/ml-activities into blockly-mooc@workspace:. dependency messageformat@npm:1.1.1 conflicts with parent dependency messageformat@npm:2.3.0

Comment on lines +5 to +14
// Sync webpack's internal public path (__webpack_require__.p) with the global.
// This is needed when this bundle is nested inside another webpack bundle (e.g.
// code-dot-org apps): webpack's automatic script-tag URL detection runs first
// and sets __webpack_require__.p to the host bundle's path. By overriding it
// here — before source files evaluate their module-level asset requires —
// asset/resource URLs (sounds, model.json) resolve to the correct location.
// Fall back to '/' for running locally.

/* eslint-disable-next-line no-undef */
__webpack_public_path__ = global.__webpack_public_path__ || '/';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kudos to Claude Code for figuring this out.

@breville breville merged commit e0e0579 into main Mar 7, 2026
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants