Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
Fix duplicate css injection
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed Sep 19, 2020
1 parent 76dfd6b commit b409a29
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/create_compilers/RollupCompiler.ts
Expand Up @@ -25,7 +25,9 @@ const inject_styles = `
export default function(files) {
return Promise.all(files.map(function(file) { return new Promise(function(fulfil, reject) {
var href = new URL(file, import.meta.url);
var link = document.querySelector('link[rel=stylesheet][href="' + href + '"]');
var relative = ('' + href).substring(document.baseURI.length);
var link = document.querySelector('link[rel=stylesheet][href="' + relative + '"]')
|| document.querySelector('link[rel=stylesheet][href="' + href + '"]');
if (!link) {
link = document.createElement('link');
link.rel = 'stylesheet';
Expand Down

0 comments on commit b409a29

Please sign in to comment.