Skip to content

Commit

Permalink
web: exclude code language chunks from service worker prefetch
Browse files Browse the repository at this point in the history
  • Loading branch information
thecodrr committed Oct 20, 2022
1 parent a1e5b57 commit a45a646
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/web/src/service-worker.js
Expand Up @@ -41,7 +41,7 @@ clientsClaim();
* @type {import("workbox-precaching/_types").PrecacheEntry[]}
*/
var precacheRoutes = self.__WB_MANIFEST;
const filters = [/KaTeX/i, /hack/i];
const filters = [/KaTeX/i, /hack/i, /code-lang-/i];
precacheAndRoute(
precacheRoutes.filter((route) => {
return filters.every((filter) => !filter.test(route.url));
Expand Down
3 changes: 3 additions & 0 deletions packages/editor/src/extensions/code-block/loader.ts
Expand Up @@ -23,6 +23,9 @@ export function isLanguageLoaded(name: string) {
}
export async function loadLanguage(shortName: string) {
const { default: language } = await import(
/* webpackChunkName: 'code-lang-[request]' */
/* webpackPrefetch: false */
/* webpackPreload: false */
`../../../languages/${shortName}.js`
);

Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Expand Up @@ -12,6 +12,7 @@
"resolveJsonModule": true,
"isolatedModules": true,
"downlevelIteration": true,
"declaration": true
"declaration": true,
"removeComments": false
}
}

0 comments on commit a45a646

Please sign in to comment.