GeezerVison is showing webpack.js.org — DefinePlugin | webpack
DefinePlugin
The DefinePlugin replaces variables in your code with other values or expressions at compile time. This can be useful for allowing different behavior between development builds and production builds. If you perform logging in your development build but not in the production build you might use a global constant to determine whether logging takes place. That's where DefinePlugin shines, set it and forget it rules for development and production builds.
newwebpack.DefinePlugin({// Definitions...});
Usage
Each key passed into DefinePlugin is an identifier or multiple identifiers joined with ..
If the value is a string it will be used as a code fragment.
If the value isn't a string, it will be stringified (including functions).
If the value is an object all keys are defined the same way.
If you prefix typeof to the key, it's only defined for typeof calls.
The values will be inlined into the code allowing a minification pass to remove the redundant conditional.
It is possible to define variables with values that rely on files and will be re-evaluated when such files change in the file system. This means webpack will rebuild when such watched files change.
There're two arguments for webpack.DefinePlugin.runtimeValue function:
The first argument is the generator function above: it receives { module, key, version } and returns the value to be assigned to the definition.
The second argument could either be an array of file paths to watch for or a true to flag the module as uncacheable. Since 5.26.0, it can also take an object argument with the following properties:
fileDependencies?: string[] A list of files the function depends on.
contextDependencies?: string[] A list of directories the function depends on.
missingDependencies?: string[] A list of not existing files the function depends on.
buildDependencies?: string[] A list of build dependencies the function depends on.
version?: string | () => string A version of the function.
You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.