diff --git a/guide/src/reference/cli.md b/guide/src/reference/cli.md index b4dc2ea04bf..538d839ca4b 100644 --- a/guide/src/reference/cli.md +++ b/guide/src/reference/cli.md @@ -107,14 +107,16 @@ Don't add WebAssembly fallback imports in generated JavaScript. ### `--split-linked-modules` -Controls whether wasm-bindgen will split linked modules out into their own files. -Enabling this is recommended, because it allows lazy loading and setting a -stricter Content Security Policy. - -wasm-bindgen uses the `new URL('…', import.meta.url)` syntax to link such split -out files. This is directly supported when using webpack 5 or no bundler at all. - -For other bundlers, ensure they support the link syntax, possibly by enabling an -extra plugin. That's why this option is disabled by default. Alternatively, -configure the bundler to keep the link syntax as is and to copy all files in -`snippets/` to the output directory preserving their paths. +Controls whether wasm-bindgen will split linked modules out into their own +files. Enabling this is recommended, because it allows lazy-loading the linked +modules and setting a stricter Content Security Policy. + +wasm-bindgen uses the `new URL('…', import.meta.url)` syntax to resolve the +links to such split out files. This breaks with most bundlers, since the +bundler doesn't know to include the linked module in its output. That's why +this option is disabled by default. Webpack 5 is an exception, which has +special treatment for that syntax. For other bundlers, you'll need to take +extra steps to get it to work, likely by using a plugin. Alternatively, you can +leave the syntax as is and instead manually configure the bundler to copy all +files in `snippets/` to the output directory, preserving their paths relative +to whichever bundled file ends up containing the JS shim.