mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-06 13:11:46 +00:00
(webpack): add missing possible 'entry' types (#19977)
* fix(webpack): add missing possible 'entry' types resolves #19972 * style(webpack): fix spacing * style(webpack): add parentheses I've added parentheses around the return type of `EntryFunc` to clarify the correct type is `() => (...types)` not `(() => string) | ...types`
This commit is contained in:
committed by
Mohamed Hegazy
parent
54cfc26a91
commit
a82b876e9c
Vendored
+4
-1
@@ -6,6 +6,7 @@
|
||||
// Tommy Troy Lin <https://github.com/tommytroylin>
|
||||
// Mohsen Azimi <https://github.com/mohsen1>
|
||||
// Jonathan Creamer <https://github.com/jcreamer898>
|
||||
// Ahmed T. Ali <https://github.com/ahmed-taj>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
@@ -36,7 +37,7 @@ declare namespace webpack {
|
||||
* If `output.pathinfo` is set, the included pathinfo is shortened to this directory.
|
||||
*/
|
||||
context?: string;
|
||||
entry?: string | string[] | Entry;
|
||||
entry?: string | string[] | Entry | EntryFunc;
|
||||
/** Choose a style of source mapping to enhance the debugging process. These values can affect build and rebuild speed dramatically. */
|
||||
devtool?: Options.Devtool;
|
||||
/** Options affecting the output. */
|
||||
@@ -103,6 +104,8 @@ declare namespace webpack {
|
||||
[name: string]: string | string[];
|
||||
}
|
||||
|
||||
type EntryFunc = () => (string | string[] | Promise<string | string[]>);
|
||||
|
||||
interface DevtoolModuleFilenameTemplateInfo {
|
||||
identifier: string;
|
||||
shortIdentifier: string;
|
||||
|
||||
@@ -76,6 +76,26 @@ configuration = {
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// https://webpack.js.org/configuration/entry-context/#dynamic-entry
|
||||
//
|
||||
|
||||
configuration = {
|
||||
entry: () => './demo'
|
||||
};
|
||||
|
||||
configuration = {
|
||||
entry: () => ['./demo', './demo2']
|
||||
};
|
||||
|
||||
configuration = {
|
||||
entry: () => new Promise((resolve) => resolve('./demo'))
|
||||
};
|
||||
|
||||
configuration = {
|
||||
entry: () => new Promise((resolve) => resolve(['./demo', './demo2']))
|
||||
};
|
||||
|
||||
//
|
||||
// https://webpack.github.io/docs/code-splitting.html
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user