Skip to content

build: drop --openssl-legacy-provider so the build works on Node 16 through 23 (#896) - #900

Merged
stevenweaver merged 2 commits into
masterfrom
issue-896-build-node-openssl
Oct 6, 2026
Merged

stevenweaver merged 2 commits into
masterfrom
issue-896-build-node-openssl

Conversation

@stevenweaver

Copy link
Copy Markdown
Member

Fixes #896. Fixes #898.

yarn build used to set NODE_OPTIONS=--openssl-legacy-provider unconditionally. Node 16 rejects that flag, and on Node 17+ (OpenSSL 3) the flag was only needed because url-loader/file-loader hash font and image file names with MD4.

Changes:

  • Fonts and images now use webpack 5 asset modules (asset with a 10 KB inline limit for woff/woff2, asset/resource for everything else) instead of url-loader/file-loader.
  • output.hashFunction: "xxhash64" in both webpack configs, so no MD4 is used anywhere.
  • build and build:library no longer set NODE_OPTIONS.
  • engines.node >=16.20.2, and a .nvmrc (22).
  • output.clean: true in the app config (webpack build does not clean dist/ (risk of serving a partial/mixed bundle on in-place rebuild) #898), so dist/ no longer keeps stale hashed files. Webpack removes them at emit time, and a failed build leaves dist/ untouched. The library config deliberately does not clean, because both configs write to dist/ and a library build would otherwise wipe the app build.
  • CI matrix now runs 18.x and 22.x.

Verified locally: yarn build succeeds on Node 16.20.2, 18, 22 and 23.3.0, and yarn test passes (5/5). In headless Chromium, the fonts, icons and images on /busted load the same as on the current live build, with no failed requests.

Deploy note: asset and chunk file names change with this PR (for example, 754.js becomes 145.js, and fonts and images get new hashed names). If dist is built elsewhere and copied into the live checkout, use rsync -a --delete so the old files don't pile up. They are harmless if left behind.

#896)

file-loader/url-loader name emitted files with loader-utils
getHashDigest, which calls crypto.createHash('md4'). OpenSSL 3 rejects
MD4 unless node runs with --openssl-legacy-provider, and node builds
on OpenSSL 1.1 refuse that flag in NODE_OPTIONS, so the unconditional
flag in the build scripts broke one group or the other.

- Handle fonts and images with webpack 5 asset modules (asset for
  woff/woff2 with the same 10000 byte inline limit, asset/resource for
  the rest) in webpack.config.js and webpack.config.library.js.
- Set output.hashFunction to xxhash64 so no MD4 is used anywhere.
- Remove NODE_OPTIONS=--openssl-legacy-provider from build and
  build:library.
- Add engines.node >=16.20.2 and .nvmrc (22).

This also fixes a latent bug: woff/woff2 matched both the url-loader
and file-loader rules, so the CSS pointed at data: URIs holding
file-loader's JS output instead of the font files; browsers fell back
to ttf/eot. The woff/woff2 references now resolve to the emitted files.
Content-hashed asset and chunk names changed with the move off MD4, so
set output.clean in the app webpack config to stop stale files piling up
in dist/. Add 22.x to the CI matrix to match .nvmrc.
@stevenweaver
stevenweaver merged commit 37f505b into master Oct 6, 2026
2 checks passed
@stevenweaver
stevenweaver deleted the issue-896-build-node-openssl branch October 6, 2026 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant