mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Add CodeValueObject (#42065)
This commit is contained in:
parent
7cba407dbd
commit
2fa35a8617
3
types/webpack/index.d.ts
vendored
3
types/webpack/index.d.ts
vendored
@ -1665,7 +1665,7 @@ declare namespace webpack {
|
||||
}
|
||||
|
||||
class DefinePlugin extends Plugin {
|
||||
constructor(definitions: { [key: string]: DefinePlugin.CodeValuePrimitive});
|
||||
constructor(definitions: {[key: string]: DefinePlugin.CodeValueObject});
|
||||
static runtimeValue(
|
||||
fn: ({ module }: { module: compilation.Module }) => DefinePlugin.CodeValuePrimitive,
|
||||
fileDependencies?: string[]
|
||||
@ -1681,6 +1681,7 @@ declare namespace webpack {
|
||||
exec(parser: compilation.normalModuleFactory.Parser): CodeValuePrimitive;
|
||||
}
|
||||
type CodeValuePrimitive = string | number | boolean | RegExp | RuntimeValue | null | undefined;
|
||||
type CodeValueObject = CodeValuePrimitive | {[key: string]: CodeValueObject};
|
||||
}
|
||||
|
||||
class DllPlugin extends Plugin {
|
||||
|
||||
@ -446,6 +446,17 @@ plugin = new webpack.DefinePlugin({
|
||||
BROWSER_SUPPORTS_HTML5: true,
|
||||
TWO: "1+1",
|
||||
"typeof window": JSON.stringify("object"),
|
||||
OBJECT: {
|
||||
foo: "bar",
|
||||
bar: {
|
||||
DEEP_RUNTIME: webpack.DefinePlugin.runtimeValue(
|
||||
() => JSON.stringify("DEEP_RUUNTIME")
|
||||
),
|
||||
foofoo: {
|
||||
barbar: false
|
||||
}
|
||||
}
|
||||
},
|
||||
RUNTIME: webpack.DefinePlugin.runtimeValue(
|
||||
() => JSON.stringify("TEST_VALUE")
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user