From 7d0e877d328fa14653635d9b9f961f21741e9836 Mon Sep 17 00:00:00 2001 From: adamsilverstein Date: Wed, 18 Feb 2026 21:39:29 +0700 Subject: [PATCH] Build: Remove all sourceMappingURL comments when copying Gutenberg files. The `removeSourceMaps` regex was missing the `/g` (global) flag, so it only stripped the first `sourceMappingURL` comment per file. Bundled files such as the vips web worker can contain multiple sourceMappingURL references from concatenated modules, causing the `verify:source-maps` build check to fail. Adding the `/g` flag ensures every occurrence is removed, consistent with the existing `replace:source-maps` Grunt task which already uses the global flag. Co-Authored-By: Claude Opus 4.6 --- tools/gutenberg/copy-gutenberg-build.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/gutenberg/copy-gutenberg-build.js b/tools/gutenberg/copy-gutenberg-build.js index d707a2812e528..36b55bcae5d64 100644 --- a/tools/gutenberg/copy-gutenberg-build.js +++ b/tools/gutenberg/copy-gutenberg-build.js @@ -922,7 +922,7 @@ async function main() { // Transform function to remove source map comments from all JS files const removeSourceMaps = ( content ) => { - return content.replace( /\/\/# sourceMappingURL=.*$/m, '' ).trimEnd(); + return content.replace( /\/\/# sourceMappingURL=.*$/gm, '' ).trimEnd(); }; if ( fs.existsSync( scriptsSrc ) ) {