Merge pull request #7100 from overleaf/ae-worker-hash

Improve webpack config for Web Worker scripts

GitOrigin-RevId: 38773291726d31cc31a8360049db67103198582b
This commit is contained in:
Jakob Ackermann 2022-03-17 11:00:06 +00:00 committed by Copybot
parent 29aa7c622a
commit bd74a149ce

View file

@ -101,15 +101,15 @@ module.exports = {
],
},
{
// Wrap PDF.js worker in a Web Worker
test: /pdf\.worker\.js$/,
// Wrap worker scripts in a Web Worker
test: /\.worker\.js$/,
use: [
{
loader: 'worker-loader',
options: {
// Write into js directory (note: customising this is not possible
// with pdfjs-dist/webpack auto loader)
name: 'js/pdfjs-worker.[hash].js',
name: 'js/[name].[contenthash].js',
// Override dynamically-set publicPath to explicitly use root.
// This prevents a security problem where the Worker - normally
// loaded from a CDN - has cross-origin issues, by forcing it to not
@ -130,18 +130,6 @@ module.exports = {
},
],
},
{
test: /latex-linter.worker.js$/,
use: [
{
loader: 'worker-loader',
options: {
name: 'js/latex-linter.worker.js',
publicPath: '/',
},
},
],
},
{
// Pass Less files through less-loader/css-loader/mini-css-extract-
// plugin (note: run in reverse order)