Skip to content

Commit b0a31a7

Browse files
authored
fix: don't modify loaded tag (#2586)
1 parent e1518e2 commit b0a31a7

File tree

2 files changed

+24
-19
lines changed

2 files changed

+24
-19
lines changed

.changeset/sixty-bugs-turn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@module-federation/sdk': patch
3+
---
4+
5+
fix: don't modify loaded tag

packages/sdk/src/dom.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,19 @@ export function createScript(info: {
6464
if (createScriptRes.timeout) timeout = createScriptRes.timeout;
6565
}
6666
}
67-
}
6867

69-
const attrs = info.attrs;
70-
if (attrs) {
71-
Object.keys(attrs).forEach((name) => {
72-
if (script) {
73-
if (name === 'async' || name === 'defer') {
74-
script[name] = attrs[name];
75-
} else {
76-
script.setAttribute(name, attrs[name]);
68+
const attrs = info.attrs;
69+
if (attrs) {
70+
Object.keys(attrs).forEach((name) => {
71+
if (script) {
72+
if (name === 'async' || name === 'defer') {
73+
script[name] = attrs[name];
74+
} else {
75+
script.setAttribute(name, attrs[name]);
76+
}
7777
}
78-
}
79-
});
78+
});
79+
}
8080
}
8181

8282
const onScriptComplete = (
@@ -156,15 +156,15 @@ export function createLink(info: {
156156
link = createLinkRes;
157157
}
158158
}
159-
}
160159

161-
const attrs = info.attrs;
162-
if (attrs) {
163-
Object.keys(attrs).forEach((name) => {
164-
if (link) {
165-
link.setAttribute(name, attrs[name]);
166-
}
167-
});
160+
const attrs = info.attrs;
161+
if (attrs) {
162+
Object.keys(attrs).forEach((name) => {
163+
if (link) {
164+
link.setAttribute(name, attrs[name]);
165+
}
166+
});
167+
}
168168
}
169169

170170
const onLinkComplete = (

0 commit comments

Comments
 (0)