From 2aa5f80c0d4e3d92cda6b3b12e37814f6bfaf838 Mon Sep 17 00:00:00 2001 From: kongjiacong Date: Thu, 20 Apr 2023 00:56:51 +0800 Subject: [PATCH 1/3] chore: update asset_copy test case snapshot --- .../test/__snapshots__/index.test.ts.snap | 14 -------------- 1 file changed, 14 deletions(-) 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`] = ` " From 650c8f5ef67a51a84e49d72841e47756816baa1c Mon Sep 17 00:00:00 2001 From: kongjiacong Date: Thu, 20 Apr 2023 01:09:24 +0800 Subject: [PATCH 2/3] fix: replaceAll not work in node v14 --- packages/runtime/plugin-runtime/src/document/cli/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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', From d8a074ceb6422f28d040711b163d1b83b32026cb Mon Sep 17 00:00:00 2001 From: kongjiacong Date: Thu, 20 Apr 2023 01:12:06 +0800 Subject: [PATCH 3/3] docs: add changeset --- .changeset/quiet-pets-collect.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/quiet-pets-collect.md 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