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
Reactions are currently unavailable
Overview
In webpack,
output.chunkFilenamecan be either a string or a function returning a string.However, the webpack loader in
@shopify/web-workerassumes it is only a string:quilt/packages/web-worker/src/webpack-parts/loader.ts
Lines 94 to 96 in 34ac07a
quilt/packages/web-worker/src/webpack-parts/loader.ts
Lines 151 to 155 in 34ac07a
This leads to
TypeError: file.includes is not a functionerrors when using something likeTo fix this, first check whether it's a function, and then maybe add a wrapper function that adds the suffix.
Consuming repo
https://github.com/swissspidy/media-experiments
Area
Area: <area>labels to this issueScope
Is this issue related to a specific package?
Package: <package_name>label.Checklist