Skip to content

Commit

Permalink
fixing script paths
Browse files Browse the repository at this point in the history
  • Loading branch information
jperezlatimes committed Jul 17, 2024
1 parent a43a56b commit 6171e66
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/blocks/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export function createScriptBlock(baker) {
legacy
} = manifest;

const pathSrc = baker.getStaticPath()
const modernEntry = modern[entry];
const cssEntry = css[entry];
const output = [];
Expand All @@ -30,26 +29,26 @@ export function createScriptBlock(baker) {
if (shouldPreload) {
preloads.forEach((preload) => {
output.push(
`<link rel="preload" href="${[pathSrc, preload].join('/')}" as="script" crossorigin>`
`<link rel="preload" href="${baker.getStaticPath(preload)}" as="script" crossorigin>`
);
});
}

if (!!cssEntry) {
output.push(
`<link rel="stylesheet" href="${[pathSrc, cssEntry].join('/')}">`
`<link rel="stylesheet" href="${baker.getStaticPath(cssEntry)}">`
);
}

if (!!modernEntry) {
output.push(
`<script type="module" src="${[pathSrc, modernEntry].join('/')}"></script>`
`<script type="module" src="${baker.getStaticPath(modernEntry)}"></script>`
);
}

if (!!legacy) {
output.push(
`<script nomodule defer src="${[pathSrc, legacy[entry]].join('/')}"></script>`
`<script nomodule defer src="${baker.getStaticPath(legacy[entry])}"></script>`
);
}

Expand Down

0 comments on commit 6171e66

Please sign in to comment.