From 9c1b9fc5da8fb19ad17fc78bf710627bbf5ae715 Mon Sep 17 00:00:00 2001 From: alexander-akait <4567934+alexander-akait@users.noreply.github.com> Date: Sat, 5 Sep 2026 12:55:42 +0000 Subject: [PATCH 1/5] fix: read the parse goal an embedded JavaScript body is handed out with MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `as` names which production of JavaScript a body is written in, the way it already names which production of CSS a `style=""` holds. The four built-in JavaScript minimizers now read it as their own `module` option, so a module script is not read as a classic one — and none of their engines is handed a word it would reject outright. --- .changeset/embedded-javascript-parse-goal.md | 5 + README.md | 8 ++ src/utils.js | 35 +++++- test/embedded-protocol.test.js | 112 ++++++++++++++++++- 4 files changed, 150 insertions(+), 10 deletions(-) create mode 100644 .changeset/embedded-javascript-parse-goal.md diff --git a/.changeset/embedded-javascript-parse-goal.md b/.changeset/embedded-javascript-parse-goal.md new file mode 100644 index 00000000..e259beb7 --- /dev/null +++ b/.changeset/embedded-javascript-parse-goal.md @@ -0,0 +1,5 @@ +--- +"minimizer-webpack-plugin": patch +--- + +read `as` on an embedded JavaScript body as the built-in minimizers' own `module` option, so a module script is not read as a classic one and the engine is never handed the word diff --git a/README.md b/README.md index 4696f079..e19c5808 100644 --- a/README.md +++ b/README.md @@ -1020,6 +1020,14 @@ stylesheet, so a minifier claiming `css` is handed one either way and `as` says which it is. Ignore it at your peril: parsing a declaration list as a stylesheet finds no rule and returns nothing. +A `