mirror of https://github.com/webpack/webpack.git
Make workerPublicPath optional and update docs
This commit is contained in:
parent
c188270d13
commit
0df564bc98
|
@ -570,7 +570,7 @@ export type UniqueName = string;
|
|||
*/
|
||||
export type WebassemblyModuleFilename = string;
|
||||
/**
|
||||
* Worker public path.
|
||||
* Worker public path. Much like the public path, this sets the location that the worker script file is intended to be found at. If not set, Webpack will use the publicPath. Don't set this option unless your worker scripts are located at a different path from your other script files.
|
||||
*/
|
||||
export type WorkerPublicPath = string;
|
||||
/**
|
||||
|
@ -2169,7 +2169,7 @@ export interface Output {
|
|||
*/
|
||||
workerChunkLoading?: ChunkLoading;
|
||||
/**
|
||||
* Worker public path.
|
||||
* Worker public path. Much like the public path, this sets the location that the worker script file is intended to be found at. If not set, Webpack will use the publicPath. Don't set this option unless your worker scripts are located at a different path from your other script files.
|
||||
*/
|
||||
workerPublicPath?: WorkerPublicPath;
|
||||
/**
|
||||
|
|
|
@ -80,9 +80,12 @@ WorkerDependency.Template = class WorkerDependencyTemplate extends (
|
|||
source.replace(
|
||||
dep.range[0],
|
||||
dep.range[1] - 1,
|
||||
`/* worker import */ "${dep.options.publicPath}" + ${
|
||||
RuntimeGlobals.getChunkScriptFilename
|
||||
}(${JSON.stringify(chunk.id)}), ${RuntimeGlobals.baseURI}`
|
||||
`/* worker import */ "${
|
||||
// We use the workerPublicPath option if provided, else we fallback to the RuntimeGlobal publicPath
|
||||
dep.options.publicPath || RuntimeGlobals.publicPath
|
||||
}" + ${RuntimeGlobals.getChunkScriptFilename}(${JSON.stringify(
|
||||
chunk.id
|
||||
)}), ${RuntimeGlobals.baseURI}`
|
||||
);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue