import ProjextWebpackRuntimeDefinitions from 'projext-plugin-webpack/src/plugins/runtimeDefinitions/index.js'
ProjextWebpackRuntimeDefinitions
This is a webpack plugin that works with webpack.DefinePlugin
in order to reload all
definitions when the bundle changes.
Constructor Summary
Public Constructor | ||
public |
constructor(files: Array, definitionsFn: Function():Object, options: ProjextWebpackRuntimeDefinitionsOptions) |
Method Summary
Public Methods | ||
public |
This is called by webpack when the plugin is being processed. |
|
public |
Get the options that customize the plugin instance. |
Public Constructors
public constructor(files: Array, definitionsFn: Function():Object, options: ProjextWebpackRuntimeDefinitionsOptions) source
Params:
Name | Type | Attribute | Description |
files | Array | The list of files that need to change in order to reload the definitions. |
|
definitionsFn | Function():Object | When this function is called, it should return the object with the definitions. |
|
options | ProjextWebpackRuntimeDefinitionsOptions |
|
The options to customize the plugin instance. |
Public Methods
public apply(compiler: Object) source
This is called by webpack when the plugin is being processed. The method will create a new
instance of webpack.DefinePlugin
and set all the values as "runtime values", so they'll
get evaluated every time the bundle is generated.
The method will also tap into the compile
hook, so this plugin can refresh the values (by
calling the definitionFn
) when the bundle is about to be generated.
Params:
Name | Type | Attribute | Description |
compiler | Object | The compiler information provided by webpack. |
public getOptions(): ProjextWebpackRuntimeDefinitionsOptions source
Get the options that customize the plugin instance.