diff --git a/app/public/mockServiceWorker.js b/app/public/mockServiceWorker.js index c12ecf9..f02e128 100644 --- a/app/public/mockServiceWorker.js +++ b/app/public/mockServiceWorker.js @@ -2,7 +2,7 @@ /* tslint:disable */ /** - * Mock Service Worker (0.36.3). + * Mock Service Worker (0.36.8). * @see https://github.com/mswjs/msw * - Please do NOT modify this file. * - Please do NOT serve this file on production. diff --git a/app/src/app/AppRouter.tsx b/app/src/app/AppRouter.tsx index 62b3d96..4b3dcaa 100644 --- a/app/src/app/AppRouter.tsx +++ b/app/src/app/AppRouter.tsx @@ -16,11 +16,21 @@ const lazyWithPreload = >( factory, }); -const CodePage = lazyWithPreload(() => import("./pages/CodePage")); -const IndexPage = lazyWithPreload(() => import("./pages/IndexPage")); -const MessagesPage = lazyWithPreload(() => import("./pages/MessagesPage")); -const ScannerPage = lazyWithPreload(() => import("./pages/ScannerPage")); -const StartPage = lazyWithPreload(() => import("./pages/StartPage")); +const CodePage = lazyWithPreload( + () => import(/* webpackChunkName: "CodePage" */ "./pages/CodePage") +); +const IndexPage = lazyWithPreload( + () => import(/* webpackChunkName: "IndexPage" */ "./pages/IndexPage") +); +const MessagesPage = lazyWithPreload( + () => import(/* webpackChunkName: "MessagesPage" */ "./pages/MessagesPage") +); +const ScannerPage = lazyWithPreload( + () => import(/* webpackChunkName: "ScannerPage" */ "./pages/ScannerPage") +); +const StartPage = lazyWithPreload( + () => import(/* webpackChunkName: "StartPage" */ "./pages/StartPage") +); const routeFactories = [ { diff --git a/app/src/common/components/QRCodeReader.tsx b/app/src/common/components/QRCodeReader.tsx index acd49c4..53ca7ac 100644 --- a/app/src/common/components/QRCodeReader.tsx +++ b/app/src/common/components/QRCodeReader.tsx @@ -56,7 +56,9 @@ const QRCodeReader = ({ torch = false, onResult }: QRCodeReaderProps) => { } // The zxing library is HUGE, thus we load it asynchronously - const { BrowserQRCodeReader } = await import("@zxing/browser"); + const { BrowserQRCodeReader } = await import( + /* webpackChunkName: "zxing" */ "@zxing/browser" + ); const codeReader = new BrowserQRCodeReader(); controls.current = await codeReader.decodeFromVideoElement( diff --git a/app/src/common/components/QrCode.tsx b/app/src/common/components/QrCode.tsx index 3479c71..e545ea0 100644 --- a/app/src/common/components/QrCode.tsx +++ b/app/src/common/components/QrCode.tsx @@ -31,7 +31,9 @@ const QrCode = ({ contents, width = 300, height = 300 }: QrCodeProps) => { React.useEffect(() => { (async () => { if (!writer.current) { - const { BrowserQRCodeSvgWriter } = await import("@zxing/browser"); + const { BrowserQRCodeSvgWriter } = await import( + /* webpackChunkName: "zxing" */ "@zxing/browser" + ); writer.current = new BrowserQRCodeSvgWriter(); } diff --git a/app/webpack.config.js b/app/webpack.config.js index ecd8378..f59eba6 100644 --- a/app/webpack.config.js +++ b/app/webpack.config.js @@ -7,6 +7,8 @@ module.exports = { output: { clean: true, publicPath: "/", + chunkFilename: "javascripts/chunks/[chunkhash].[name].js", + filename: "javascripts/[contenthash].[name].js", }, module: { rules: [