This repository has been archived by the owner on Feb 18, 2024. It is now read-only.
Lazily require() webpack plugins to improve performance #1101
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
webpack-chain 4.11.0's
config.plugin('abc').use(...)
now also supports being passed the path to a plugin, rather than just the already-require()
ed plugin itself. See:neutrinojs/webpack-chain#102
This means we can avoid the expensive
require()
of plugins in cases where the plugin isn't used - such as when:.eslintrc.js
NODE_ENV
(egclean-webpack-plugin
isn't used in development).For example, this reduces
time node .eslintrc.js
for a React+AirBnb project from 1700ms to 370ms - and for projects that use more of the non-default core Neutrino presets, the improvement will be even more noticeable.As an added bonus, plugins specified by path also have their
require()
statement generated automatically when usingtoString()
, meaning that the configuration output by--inspect
no longer needs any adjustments before it can be run.ie this "just works" with the core presets:
The webpack-chain docs have also been synced with those from upstream.
Refs #239.