This repository was archived by the owner on Jan 10, 2025. It is now read-only.

Description
Overview
In webpack, output.chunkFilename can be either a string or a function returning a string.
However, the webpack loader in @shopify/web-worker assumes it is only a string:
|
chunkFilename: addWorkerSubExtension( |
|
compiler.options.output.chunkFilename as string, |
|
), |
|
function addWorkerSubExtension(file: string) { |
|
return file.includes('[name]') |
|
? file.replace(/\.([a-z]+)$/i, '.worker.$1') |
|
: file.replace(/\.([a-z]+)$/i, '.[name].worker.$1'); |
|
} |
This leads to TypeError: file.includes is not a function errors when using something like
output: {
chunkFilename: (pathData) => {
console.log(pathData.chunk.name);
return '[name].js';
},
}
To fix this, first check whether it's a function, and then maybe add a wrapper function that adds the suffix.
Consuming repo
What repo were you working in when this issue occurred?
https://github.com/swissspidy/media-experiments
Area
Scope
Checklist