From cedc14fb8dae9aa9e042578a394b824a1d1bdcc2 Mon Sep 17 00:00:00 2001 From: Mistium <92952823+Mistium@users.noreply.github.com> Date: Mon, 21 Sep 2026 02:12:57 +0100 Subject: [PATCH] Transpile src for the website and node builds too webpack 4's parser predates nullish coalescing, and src/packager/packager.js uses it in the CSP meta template. Only makeScaffolding configured babel-loader, so makeWebsite -- which reaches packager.js through src/p4/Downloads.svelte -- parsed it raw and died with "Module parse failed: Unexpected token (1235:30)". master has been red since 2026-09-08 for this reason. The rule is now a shared makeJavascriptRule() used by all three configs. makeNode had the same gap and the same entry path into packager.js, so it gets the rule as well; it only runs under BUILD_MODE=node, which CI does not exercise. All three CI steps pass locally: npm run build, npm test (16 suites, 48 passed) and npm run build-standalone-prod. Co-Authored-By: Claude Opus 5 (1M context) --- webpack.config.js | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 9234709b7..1d4803ee5 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -30,6 +30,21 @@ const getVersion = () => { }; const version = getVersion(); +// webpack 4's parser predates nullish coalescing, which src/packager/packager.js +// uses. Every config that pulls in src/ needs babel-loader, not just scaffolding. +const makeJavascriptRule = () => ({ + test: /\.jsx?$/, + loader: 'babel-loader', + include: [ + path.resolve(__dirname, 'src'), + /node_modules[\\/]scratch-[^\\/]+[\\/]src/ + ], + options: { + babelrc: false, + presets: ['@babel/preset-env'] + } +}); + const makeScaffolding = ({full}) => ({ ...base, devtool: isProduction ? '' : 'source-map', @@ -54,18 +69,7 @@ const makeScaffolding = ({full}) => ({ }, module: { rules: [ - { - test: /\.jsx?$/, - loader: 'babel-loader', - include: [ - path.resolve(__dirname, 'src'), - /node_modules[\\/]scratch-[^\\/]+[\\/]src/ - ], - options: { - babelrc: false, - presets: ['@babel/preset-env'] - } - }, + makeJavascriptRule(), { test: /\.(svg|png)$/i, use: [{ @@ -154,6 +158,7 @@ const makeWebsite = () => ({ }, module: { rules: [ + makeJavascriptRule(), { test: /\.png|\.svg$/i, use: isStandalone ? { @@ -229,6 +234,7 @@ const makeNode = () => ({ }, module: { rules: [ + makeJavascriptRule(), { test: /\.png|\.svg$/i, use: 'file-loader'