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 <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
This commit is contained in:
Martin Renvoize 2026-03-20 15:03:47 +00:00
parent 1623f6898f
commit bb4407a0ff
No known key found for this signature in database
GPG Key ID: 2D86E0EAEC83711B
1 changed files with 1 additions and 0 deletions

View File

@ -196,6 +196,7 @@ module.exports = [
output: {
filename: "[name].js",
path: path.resolve(__dirname, "t/cypress/plugins/dist/"),
clean: true,
library: {
type: "commonjs",
},