Skip to content

Commit

Permalink
fix: update asset_copy test case snapshot, document node 14 error (#3504
Browse files Browse the repository at this point in the history
)

* chore: update asset_copy test case snapshot

* fix: replaceAll not work in node v14

* docs: add changeset
  • Loading branch information
zllkjc authored Apr 19, 2023
1 parent 4c74ea7 commit 8b634f9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
6 changes: 6 additions & 0 deletions .changeset/quiet-pets-collect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@modern-js/runtime': patch
---

fix: 更新集测 snapshot,修复 document 功能在 node 14 下的错误
fix: update test snapshot, fix document error in node 14
4 changes: 2 additions & 2 deletions packages/runtime/plugin-runtime/src/document/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export default (): CliPlugin<AppTools> => ({
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',
Expand All @@ -215,7 +215,7 @@ export default (): CliPlugin<AppTools> => ({
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',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`copy assets should copy public html and replace the assetPrefix variable 1`] = `
"<!DOCTYPE html>
<html>
<head>
<script>
window.__assetPrefix__ = 'https://demo.com';
window.__assetPrefix2__ = 'https://demo.com';
window.__assetPrefix3__ = 'https://demo.com';
</script>
</head>
</html>
"
`;

exports[`copy assets should copy public html and replace the assetPrefix variable in rspack 1`] = `
"<!DOCTYPE html>
<html>
Expand Down

0 comments on commit 8b634f9

Please sign in to comment.