Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cjtantay committed Jun 13, 2024
1 parent 89a43b6 commit a1b326f
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions lib/blocks/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,37 +27,44 @@ export function createScriptBlock(pathPrefix, source) {
preloads.forEach((preload) => {
const preloadPath = [pathPrefix, preload].join('/');
const preloadUrl = new URL(preloadPath, basePath);
const resolvedPreload = resolve(pathPrefix, preload)
const resolvedPreload = resolve(pathPrefix, preload);
output.push(
`<link rel="preload" href="${basePath ? preloadUrl : resolvedPreload}" as="script" crossorigin>`
`<link rel="preload" href="${
basePath ? preloadUrl : resolvedPreload
}" as="script" crossorigin>`
);

});
}

if (cssEntry) {
const cssEntryPath = [pathPrefix, cssEntry].join('/');
const cssEntryUrl = new URL(cssEntryPath, basePath);
const resolvedCssEntry = resolve(pathPrefix, cssEntry)
const resolvedCssEntry = resolve(pathPrefix, cssEntry);
output.push(
`<link rel="stylesheet" href="${basePath ? cssEntryUrl : resolvedCssEntry}">`
`<link rel="stylesheet" href="${
basePath ? cssEntryUrl : resolvedCssEntry
}">`
);
}

const modernEntryPath = [pathPrefix, modernEntry].join('/');
const modernEntryUrl = new URL(modernEntryPath, basePath);
const resolvedModernEntry = resolve(pathPrefix, modernEntry)
const resolvedModernEntry = resolve(pathPrefix, modernEntry);
output.push(
`<script type="module" src="${basePath ? modernEntryUrl : resolvedModernEntry}"></script>`
`<script type="module" src="${
basePath ? modernEntryUrl : resolvedModernEntry
}"></script>`
);

if ('legacy' in manifest) {
const legacyEntry = legacy[entry];
const legacyEntryPath = [pathPrefix, legacyEntry].join('/');
const legacyEntryUrl = new URL(legacyEntryPath, basePath);
const resolvedLegacyEntry = resolve(pathPrefix, legacyEntry)
const resolvedLegacyEntry = resolve(pathPrefix, legacyEntry);
output.push(
`<script nomodule defer src="${basePath ? legacyEntryUrl : resolvedLegacyEntry}"></script>`
`<script nomodule defer src="${
basePath ? legacyEntryUrl : resolvedLegacyEntry
}"></script>`
);
}

Expand Down

0 comments on commit a1b326f

Please sign in to comment.