lazy-build-webpack-plugin v0.0.4
Why
You have tried dynamic imports, it only does a load-on-demand, but the whole project was still been compiled. Is there a way to also benifit developers? How about not compiling dynamic code in the first place?
We don't want to wait a couple of minutes for a simple modification. People don't waste time for the things they have never used!
This is a fork from liximomo/lazy-compile-webpack-plugin with a fixes and improvements. I also reached out to original author for potentially merging
Install
# npm
npm i -D lazy-build-webpack-plugin
# yarn
yarn add -D lazy-build-webpack-pluginUsage
const LazyBuildPlugin = require('lazy-build-webpack-plugin');
module.exports = {
  entry: 'index.js',
  output: {
    path: __dirname + '/dist',
    filename: 'bundle.js',
  },
  plugins: [new LazyBuildPlugin()],
};Options
| Name | Type | Default | Description | 
|---|---|---|---|
| refreshAfterCompile | boolean | false | Enable/Disable page refresh when compilation is finish | 
| ignores | RegExp[] \| Function[] | undefined | Request to be ignored from lazy compiler | 
refreshAfterCompile
Type: boolean
Default: false
Set false for a seamless dev experience.
ignores
Type: RegExp[] | ((request: string, wpModule: object) => boolean)
Default: undefined
Request to be ignored from lazy compiler, html-webpack-plugin is always ignored.
Specifically, an Angular app should enable this option like following:
new LazyBuildWebpackPlugin({
  ignores: [
    /\b(html|raw|to-string)-loader\b/,
    /\bexports-loader[^?]*\?exports\.toString\(\)/
  ],
});