Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix compare rel attribute #3436

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading