Visitar URL original
docs: match the splash script tag to what webpack emits (#8392) · webpack/webpack.js.org@7681723 · GitHub
Skip to content

Commit 7681723

Browse files
docs: match the splash script tag to what webpack emits (#8392)
* docs: match the splash script tag to what webpack emits The page showed <script type="module" src> going in and a classic <script src> coming out, captioned as a URL rewrite, so it read as though webpack had dropped the module type. It had not: without output.module the emitted chunk is a classic IIFE, and webpack matches the tag to it - with output.module set it keeps type="module" and emits an ES module chunk. Showing a classic tag makes the before and after differ only in the URL, which is what the caption claims. The emitted page is unchanged, same content hash. * docs: keep the splash page on ES modules end to end Rather than downgrading the page's script tag to match a classic bundle, turn the config into one that emits ES modules, so type="module" survives the build. Restores the module tag on the input and adds output.module with a line saying why it is there. Verified: with this config webpack emits [javascript module] chunks and the page keeps <script type=module src=...>. The [contenthash].js template is unchanged - output.module does not force an extension. * docs: drop the removed outputModule experiment from the splash config experiments.outputModule is gone in 5.111.0 - output.module carries ESM output on its own now, per #8360. It appears nowhere in webpack's lib/ or schemas/ any more, and the 'only allowed when experiments.outputModule is enabled' check is gone with it. 5.111.0 is unreleased, so this is read from source rather than run; the installed 5.110.3 still enforces the old rule.
1 parent 59edbde commit 7681723

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

‎src/components/Splash/second/left.mdx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Point webpack at the page in **webpack.config.js**:
44
export default {
55
entry: "./src/index.html",
66
output: {
7+
// the page loads a `<script type="module">`, so emit ES modules to match
8+
module: true,
79
filename: "[contenthash].js",
810
cssFilename: "[contenthash].css",
911
htmlFilename: "[name].html",

‎src/components/Splash/second/right.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<link rel="stylesheet" href="725d71b1a0d330cfd1ad.css" />
1010
</head>
1111
<body>
12-
<script src="91b32a0aad9e59b71d57.js"></script>
12+
<script type="module" src="91b32a0aad9e59b71d57.js"></script>
1313
</body>
1414
</html>
1515
```

0 commit comments

Comments
 (0)