docs: update v1 upgrade guide - #1817
Open
elecmonkey wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the v0-to-v1 upgrade guides to document Rslib v1’s default createRequire() parsing behavior and the new/changed handling of ESM resource modules (assets via new URL(), Web Workers, and WebAssembly).
Changes:
- Document how to restore v0.x behavior by disabling Rspack’s
module.parser.javascript.createRequire. - Add upgrade guidance for ESM resource module handling:
new URL()assets, Web Workers, and WebAssembly (wasm.mode: 'preserve'forformat: 'esm'+bundle: false).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| website/docs/zh/guide/upgrade/v0-to-v1.mdx | Adds Chinese v1 upgrade guidance for createRequire() parsing and ESM resource modules. |
| website/docs/en/guide/upgrade/v0-to-v1.mdx | Adds English v1 upgrade guidance for createRequire() parsing and ESM resource modules. |
|
|
||
| 对于 `format: 'esm'` 且 `bundle: false` 的产物,Rslib v1 默认使用 [`wasm.mode: 'preserve'`](/config/lib/wasm#wasmmode)。生成的 JavaScript 会保留 `.wasm` import,`.wasm` 文件会保留原始文件名,并按照源代码中的目录结构输出。 | ||
|
|
||
| `bundle: true` 时的行为保持不变。对于 `bundle: false`,Rslib v0.x 无法生成可用的 WASM 产物;Rslib v1 默认通过 `preserve` 模式支持这一场景。使用 `preserve` 模式时,需要确保下游构建工具或目标运行时支持 WebAssembly ESM Integration。更多信息请参考 [WASM 指南](/guide/advanced/wasm)。 |
|
|
||
| For output with `format: 'esm'` and `bundle: false`, Rslib v1 uses [`wasm.mode: 'preserve'`](/config/lib/wasm#wasmmode) by default. The generated JavaScript preserves `.wasm` imports, while `.wasm` files retain their original filenames and source directory structure in the output. | ||
|
|
||
| The behavior for `bundle: true` is unchanged. With `bundle: false`, Rslib v0.x could not generate usable WASM output; Rslib v1 supports this scenario through `preserve` mode by default. When using `preserve` mode, ensure that the downstream bundler or target runtime supports WebAssembly ESM Integration. See the [WASM guide](/guide/advanced/wasm) for details. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
createRequire()parsing behavior in Rslib v1 and how to opt out.new URL()assets, Web Workers, and WebAssembly.