From f5fea0be045dae40348a7572a77c1ac42f258ed9 Mon Sep 17 00:00:00 2001 From: Andy Balaam Date: Wed, 4 Jan 2023 10:42:19 +0000 Subject: [PATCH] Explicitly set worker-loader's publicPath to webapp --- webpack.config.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/webpack.config.js b/webpack.config.js index dce54b53f3..4b56ce27aa 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -236,6 +236,15 @@ module.exports = (env, argv) => { { test: /\.worker\.ts$/, loader: "worker-loader", + options: { + // worker-loader v3 defaults to output.publicPath here, + // which causes worker.js to be included in the bundle + // in R2. This in turn causes CSP to fail when loading + // the worker. + // So, we explicitly ask to include it in the webapp + // dir. + publicPath: "webapp", + }, }, { test: /\.(ts|js)x?$/,