|
| 1 | +<div align="center"> |
| 2 | + <a href="https://github.com/webpack/webpack"> |
| 3 | + <img width="200" height="200" |
| 4 | + src="https://webpack.js.org/assets/icon-square-big.svg"> |
| 5 | + </a> |
| 6 | + <h1>Lazy Compile Webpack Plugin</h1> |
| 7 | + <p>Plugin that saves a tremendous amount of time.</p> |
| 8 | +</div> |
| 9 | + |
| 10 | +## Fork from https://github.com/liximomo/lazy-compile-webpack-plugin/ |
| 11 | + |
| 12 | +To enable windows compatibility we forked this repo and fixed the windows issue. |
| 13 | + |
| 14 | +## Why |
| 15 | + |
| 16 | +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! |
| 17 | + |
| 18 | +## Install |
| 19 | + |
| 20 | +```sh |
| 21 | +# npm |
| 22 | +npm i -D lazy-compile-webpack-plugin |
| 23 | + |
| 24 | +# yarn |
| 25 | +yarn add -D lazy-compile-webpack-plugin |
| 26 | +``` |
| 27 | + |
| 28 | +## Usage |
| 29 | + |
| 30 | +```js |
| 31 | +const LazyCompilePlugin = require('lazy-compile-webpack-plugin'); |
| 32 | + |
| 33 | +module.exports = { |
| 34 | + entry: 'index.js', |
| 35 | + output: { |
| 36 | + path: __dirname + '/dist', |
| 37 | + filename: 'bundle.js', |
| 38 | + }, |
| 39 | + plugins: [new LazyCompilePlugin()], |
| 40 | +}; |
| 41 | +``` |
| 42 | + |
| 43 | +## Options |
| 44 | + |
| 45 | +| Name | Type | Default | Description | |
| 46 | +| :-----------------------------------------------: | :---------------------: | :---------: | :------------------------------------------------------- | |
| 47 | +| **[`refreshAfterCompile`](#refreshAfterCompile)** | `boolean` | `false` | Enable/Disable _page refresh_ when compilation is finish | |
| 48 | +| **[`ignores`](#ignores)** | `RegExp[] \| Function[]` | `undefined` | Request to be ignored from lazy compiler | |
| 49 | + |
| 50 | +### `refreshAfterCompile` |
| 51 | + |
| 52 | +Type: `boolean` |
| 53 | +Default: `false` |
| 54 | + |
| 55 | +Set `false` for a seamless dev experience. |
| 56 | + |
| 57 | +### `ignores` |
| 58 | + |
| 59 | +Type: `RegExp[] | ((request: string, wpModule: object) => boolean)` |
| 60 | +Default: `undefined` |
| 61 | + |
| 62 | +Request to be ignored from lazy compiler, `html-webpack-plugin` is always ignored. |
| 63 | + |
| 64 | +Specifically, an Angular app should enable this option like following: |
| 65 | + |
| 66 | +```js |
| 67 | +new LazyCompileWebpackPlugin({ |
| 68 | + ignores: [ |
| 69 | + /\b(html|raw|to-string)-loader\b/, |
| 70 | + /\bexports-loader[^?]*\?exports\.toString\(\)/ |
| 71 | + ], |
| 72 | +}); |
| 73 | +``` |
0 commit comments