This commit is contained in:
Tobias Koppers 2022-01-19 09:18:17 +01:00
parent 2fc4c8da1b
commit e2bfe58994
5 changed files with 11 additions and 12 deletions

View File

@ -693,7 +693,7 @@ export type AssetGeneratorDataUrlFunction = (
export type AssetGeneratorOptions = AssetInlineGeneratorOptions &
AssetResourceGeneratorOptions;
/**
* Emit the asset in the specified folder instead relative to 'output.path'. This should only be needed when custom 'publicPath' is specified to match the folder structure there.
* Emit the asset in the specified folder relative to 'output.path'. This should only be needed when custom 'publicPath' is specified to match the folder structure there.
*/
export type AssetModuleOutputPath =
| string
@ -2715,7 +2715,7 @@ export interface AssetResourceGeneratorOptions {
*/
filename?: FilenameTemplate;
/**
* Emit the asset in the specified folder instead relative to 'output.path'. This should only be needed when custom 'publicPath' is specified to match the folder structure there.
* Emit the asset in the specified folder relative to 'output.path'. This should only be needed when custom 'publicPath' is specified to match the folder structure there.
*/
outputPath?: AssetModuleOutputPath;
/**

View File

@ -279,7 +279,6 @@ class AssetGenerator extends Generator {
sourceFilename,
...assetInfo
};
let outputFilename = filename;
if (this.outputPath) {
const { path: outputPath, info } =
runtimeTemplate.compilation.getAssetPathWithInfo(
@ -293,9 +292,9 @@ class AssetGenerator extends Generator {
}
);
assetInfo = mergeAssetInfo(assetInfo, info);
outputFilename = path.posix.join(outputPath, filename);
filename = path.posix.join(outputPath, filename);
}
module.buildInfo.filename = outputFilename;
module.buildInfo.filename = filename;
module.buildInfo.assetInfo = assetInfo;
if (getData) {
// Due to code generation caching module.buildInfo.XXX can't used to store such information
@ -303,7 +302,7 @@ class AssetGenerator extends Generator {
// TODO webpack 6 For back-compat reasons we also store in on module.buildInfo
const data = getData();
data.set("fullContentHash", fullHash);
data.set("filename", outputFilename);
data.set("filename", filename);
data.set("assetInfo", assetInfo);
}

View File

@ -140,7 +140,7 @@
]
},
"AssetModuleOutputPath": {
"description": "Emit the asset in the specified folder instead relative to 'output.path'. This should only be needed when custom 'publicPath' is specified to match the folder structure there.",
"description": "Emit the asset in the specified folder relative to 'output.path'. This should only be needed when custom 'publicPath' is specified to match the folder structure there.",
"anyOf": [
{
"type": "string",

View File

@ -1286,13 +1286,13 @@ Object {
"module-generator-asset-output-path": Object {
"configs": Array [
Object {
"description": "Emit the asset in the specified folder instead relative to 'output.path'. This should only be needed when custom 'publicPath' is specified to match the folder structure there.",
"description": "Emit the asset in the specified folder relative to 'output.path'. This should only be needed when custom 'publicPath' is specified to match the folder structure there.",
"multiple": false,
"path": "module.generator.asset.outputPath",
"type": "string",
},
],
"description": "Emit the asset in the specified folder instead relative to 'output.path'. This should only be needed when custom 'publicPath' is specified to match the folder structure there.",
"description": "Emit the asset in the specified folder relative to 'output.path'. This should only be needed when custom 'publicPath' is specified to match the folder structure there.",
"multiple": false,
"simpleType": "string",
},
@ -1338,13 +1338,13 @@ Object {
"module-generator-asset-resource-output-path": Object {
"configs": Array [
Object {
"description": "Emit the asset in the specified folder instead relative to 'output.path'. This should only be needed when custom 'publicPath' is specified to match the folder structure there.",
"description": "Emit the asset in the specified folder relative to 'output.path'. This should only be needed when custom 'publicPath' is specified to match the folder structure there.",
"multiple": false,
"path": "module.generator.asset/resource.outputPath",
"type": "string",
},
],
"description": "Emit the asset in the specified folder instead relative to 'output.path'. This should only be needed when custom 'publicPath' is specified to match the folder structure there.",
"description": "Emit the asset in the specified folder relative to 'output.path'. This should only be needed when custom 'publicPath' is specified to match the folder structure there.",
"multiple": false,
"simpleType": "string",
},

2
types.d.ts vendored
View File

@ -322,7 +322,7 @@ declare interface AssetResourceGeneratorOptions {
filename?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
/**
* Emit the asset in the specified folder instead relative to 'output.path'. This should only be needed when custom 'publicPath' is specified to match the folder structure there.
* Emit the asset in the specified folder relative to 'output.path'. This should only be needed when custom 'publicPath' is specified to match the folder structure there.
*/
outputPath?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);