From bb4407a0ffd3167bcebf32a33bd5f15498830666 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 20 Mar 2026 15:03:47 +0000 Subject: [PATCH] Bug 41587: (follow-up) Clean Cypress plugin dist on rebuild to prevent stale sourcemaps Add output.clean: true to the Cypress plugin rspack build config. Before Bug 36674 (Nov 2025), this build emitted .map files into t/cypress/plugins/dist/. After devtool: false was added, the map files were no longer generated but stale ones persisted on developer machines (dist/ is gitignored). When the rspack update in Bug 41587 rebuilt api-client.cjs.js with dynamic chunk loading, Cypress's webpack created a context module for the require() expression and matched the stale .map files (webpack's context regex matches substrings, so *.js.map matches *.js). Webpack then failed trying to parse JSON sourcemaps as JavaScript. output.clean: true ensures the dist directory is wiped on every build, so stale files from previous configurations can never accumulate. Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize --- rspack.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/rspack.config.js b/rspack.config.js index de8cc2e9d9..e925b491b5 100644 --- a/rspack.config.js +++ b/rspack.config.js @@ -196,6 +196,7 @@ module.exports = [ output: { filename: "[name].js", path: path.resolve(__dirname, "t/cypress/plugins/dist/"), + clean: true, library: { type: "commonjs", },