Skip to content

Commit

Permalink
fix: add attributes for inline runtime script (#3987)
Browse files Browse the repository at this point in the history
docs: change changeset
  • Loading branch information
zllkjc committed Jun 16, 2023
1 parent f08bbfc commit 811ccd4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .changeset/shaggy-tools-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@modern-js/builder-shared': patch
---

fix: add attributes for inline runtime script
fix: 为 inline runtime 脚本添加属性
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,8 @@ export class InlineChunkHtmlPlugin {
if (!(tag?.attributes.src && isString(tag.attributes.src))) {
return tag;
}
const scriptName = publicPath
? tag.attributes.src.replace(publicPath, '')
: tag.attributes.src;
const { src, ...otherAttrs } = tag.attributes;
const scriptName = publicPath ? src.replace(publicPath, '') : src;

if (!this.tests.some(test => test.exec(scriptName))) {
return tag;
Expand All @@ -112,6 +111,9 @@ export class InlineChunkHtmlPlugin {
publicPath,
type: 'js',
}),
attributes: {
...otherAttrs,
},
closeTag: true,
};

Expand Down

0 comments on commit 811ccd4

Please sign in to comment.