[TIMOB-27860] Webpack: Tap into hooks before/after other plugins
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | None |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2020-08-25T00:36:04.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 9.1.0 |
Components | n/a |
Labels | n/a |
Reporter | Jan Vennemann |
Assignee | Jan Vennemann |
Created | 2020-04-21T17:39:00.000+0000 |
Updated | 2020-08-25T00:36:04.000+0000 |
Description
For TIMOB-27858, plugins need the ability to tap into hooks before/after other plugins to ensure the order in which certain aspects of a plugin gets applied. This is especially important for
chainWebpack
to make sure the base configuration is present before other third-party plugins may try to modify it.
*Default behavior*
By default plugins are evaluated in series. Built-in plugins from appcd-plugin-webpack are always loaded first. Plugins from package.json
are loaded in the order they are defined there.
*API proposal*
Add options
argument as the last argument with after
/before
properties to control the order in which values will be applied.
module.exports = function (api, options) {
api.chainWebpack(
config => {
config
.entry('main')
.add('./src/main.js')
.end();
},
{ after: 'built-in:config/prod' }
);
};
PR: https://github.com/appcelerator/appcd-plugin-webpack/pull/12
Closing.