Skip to content

Commit

Permalink
fix: fix compare rel attribute
Browse files Browse the repository at this point in the history
fix: add changeset
  • Loading branch information
Ernest Ragozin committed Jan 14, 2025
1 parent 6e3afc6 commit c67f459
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/gentle-brooms-invite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@module-federation/sdk': patch
---

fix(sdk): Fix duplicate css, change ref attr to rel
2 changes: 1 addition & 1 deletion packages/sdk/__tests__/dom.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ describe('createLink', () => {
expect(needAttach).toBe(true);
});

xit('should reuse an existing link element if one exists', () => {
it('should reuse an existing link element if one exists', () => {
const url = 'https://example.com/script.js';
const cb = jest.fn();
document.head.innerHTML = `<link href="${url}" rel="preload" as="script">`;
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/src/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ export function createLink(info: {
for (let i = 0; i < links.length; i++) {
const l = links[i];
const linkHref = l.getAttribute('href');
const linkRef = l.getAttribute('ref');
const linkRel = l.getAttribute('rel');
if (
linkHref &&
isStaticResourcesEqual(linkHref, info.url) &&
linkRef === info.attrs['ref']
linkRel === info.attrs['rel']
) {
link = l;
needAttach = false;
Expand Down

0 comments on commit c67f459

Please sign in to comment.