diff --git a/.changeset/quiet-pets-collect.md b/.changeset/quiet-pets-collect.md new file mode 100644 index 000000000000..8dc36856bee5 --- /dev/null +++ b/.changeset/quiet-pets-collect.md @@ -0,0 +1,6 @@ +--- +'@modern-js/runtime': patch +--- + +fix: 更新集测 snapshot,修复 document 功能在 node 14 下的错误 +fix: update test snapshot, fix document error in node 14 diff --git a/packages/runtime/plugin-runtime/src/document/cli/index.ts b/packages/runtime/plugin-runtime/src/document/cli/index.ts index a1625be985b0..be93f698f180 100644 --- a/packages/runtime/plugin-runtime/src/document/cli/index.ts +++ b/packages/runtime/plugin-runtime/src/document/cli/index.ts @@ -202,7 +202,7 @@ export default (): CliPlugin => ({ html.includes(DOCUMENT_SCRIPT_PLACEHOLDER_START) && html.includes(DOCUMENT_SCRIPT_PLACEHOLDER_END) ) { - html = html.replaceAll( + html = html.replace( new RegExp( `${DOCUMENT_SCRIPT_PLACEHOLDER_START}(.*?)${DOCUMENT_SCRIPT_PLACEHOLDER_END}`, 'g', @@ -215,7 +215,7 @@ export default (): CliPlugin => ({ html.includes(DOCUMENT_COMMENT_PLACEHOLDER_START) && html.includes(DOCUMENT_COMMENT_PLACEHOLDER_END) ) { - html = html.replaceAll( + html = html.replace( new RegExp( `${DOCUMENT_COMMENT_PLACEHOLDER_START}(.*?)${DOCUMENT_COMMENT_PLACEHOLDER_END}`, 'g', diff --git a/tests/integration/copy-assets/test/__snapshots__/index.test.ts.snap b/tests/integration/copy-assets/test/__snapshots__/index.test.ts.snap index 32948f9142f5..fe857373bd42 100644 --- a/tests/integration/copy-assets/test/__snapshots__/index.test.ts.snap +++ b/tests/integration/copy-assets/test/__snapshots__/index.test.ts.snap @@ -1,19 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`copy assets should copy public html and replace the assetPrefix variable 1`] = ` -" - - - - - -" -`; - exports[`copy assets should copy public html and replace the assetPrefix variable in rspack 1`] = ` "