lazy-compile-webpack-plugin
Version:
Lazy compile dynamic imports to boost your webpack startup time.
70 lines (51 loc) • 2.12 kB
Markdown
<div align="center">
<a href="https://github.com/webpack/webpack">
<img width="200" height="200"
src="https://webpack.js.org/assets/icon-square-big.svg">
</a>
<h1>Lazy Compile Webpack Plugin</h1>
<p>Plugin that saves a tremendous amount of time.</p>
</div>
Starting the development server is taking you a long time when the codebase is large. You have tried dynamic imports, it only does a load-on-demand, the whole project was still been compiled. 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!
```sh
npm i --save-dev lazy-compile-webpack-plugin
yarn add --dev lazy-compile-webpack-plugin
```
```js
const LazyCompilePlugin = require('lazy-compile-webpack-plugin');
module.exports = {
entry: 'index.js',
output: {
path: __dirname + '/dist',
filename: 'bundle.js',
},
plugins: [new LazyCompilePlugin()],
};
```
| Name | Type | Default | Description |
| :-----------------------------------------------: | :---------------------: | :---------: | :------------------------------------------------------- |
| **[`refreshAfterCompile`](
| **[`ignores`](
Type: `boolean`
Default: `false`
Set `false` for a seamless dev experience.
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:
```js
new LazyCompileWebpackPlugin({
ignores: [
/\b(html|raw|to-string)-loader\b/,
/\bexports-loader[^?]*\?exports\.toString\(\)/
],
});
```