mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 13:00:19 +00:00
webpack: Accept a function for filename (#38989)
https://webpack.js.org/configuration/output/#outputfilename Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
committed by
Armando Aguirre
parent
208e84991c
commit
fa252d845d
Vendored
+6
-1
@@ -17,6 +17,7 @@
|
||||
// Kyle Uehlein <https://github.com/kuehlein>
|
||||
// Grgur Grisogono <https://github.com/grgur>
|
||||
// Rubens Pinheiro Gonçalves Cavalcante <https://github.com/rubenspgcavalcante>
|
||||
// Anders Kaseorg <https://github.com/andersk>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -153,7 +154,7 @@ declare namespace webpack {
|
||||
/** When used in tandem with output.library and output.libraryTarget, this option allows users to insert comments within the export wrapper. */
|
||||
auxiliaryComment?: string | AuxiliaryCommentObject;
|
||||
/** The filename of the entry chunk as relative path inside the output.path directory. */
|
||||
filename?: string;
|
||||
filename?: string | ((chunkData: ChunkData) => string);
|
||||
/** The filename of non-entry chunks as relative path inside the output.path directory. */
|
||||
chunkFilename?: string;
|
||||
/** Number of milliseconds before chunk request expires, defaults to 120,000. */
|
||||
@@ -234,6 +235,10 @@ declare namespace webpack {
|
||||
|
||||
type AuxiliaryCommentObject = { [P in LibraryTarget]: string };
|
||||
|
||||
interface ChunkData {
|
||||
chunk: compilation.Chunk;
|
||||
}
|
||||
|
||||
interface Module {
|
||||
/** A array of applied pre loaders. */
|
||||
preLoaders?: RuleSetRule[];
|
||||
|
||||
@@ -989,3 +989,12 @@ webpack.Template.renderChunkModules(
|
||||
[],
|
||||
'a',
|
||||
);
|
||||
|
||||
// https://webpack.js.org/configuration/output/#outputfilename
|
||||
configuration = {
|
||||
output: {
|
||||
filename: chunkData => {
|
||||
return chunkData.chunk.name === 'main' ? '[name].js' : '[name]/[name].js';
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user