Skip to content

Commit

Permalink
Merge pull request #227 from mgreminger/sw-fix
Browse files Browse the repository at this point in the history
fix: allow transformed index.html
  • Loading branch information
mgreminger authored Jan 10, 2024
2 parents bafc123 + 52b0071 commit 60fd40d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

<script defer id="MathJax-script" src="build/mathjax/tex-svg.js"></script>

<!-- canonical URL added below when launched from epxyz.com -->
</head>

<body class="mathjax_ignore">
Expand Down
15 changes: 1 addition & 14 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ export default [
maximumFileSizeToCacheInBytes: 40*1000**2,
inlineWorkboxRuntime: true,
sourcemap: !production,
mode: production ? "production" : "dev",
manifestTransforms: [integrityManifestTransform]
mode: production ? "production" : "dev"
},
function render({ swDest, count, size }) {
console.log(`Service worker ${swDest} set to precache ${count} files totalling ${size/(1000**2)} MB.`)
Expand All @@ -158,15 +157,3 @@ export default [
clearScreen: false
}
}];


async function integrityManifestTransform(originalManifest, compilation) {
const warnings = [];
const manifest = await Promise.all(originalManifest.map(async entry => {
const fd = await open(join('public', entry.url));
entry.integrity = (await ssri.fromStream(fd.createReadStream())).toString();
return entry;
}));

return {warnings, manifest};
};

0 comments on commit 60fd40d

Please sign in to comment.