A umi plugin to help you make local built JS module as webpack external bundle, you can pre-build some modules then use this plugin to improve the performance of building.
Why I need this plugin?
- You want to improve building performance of umi.
- Maybe you don't want to upload external modules to CDN.
- More importantly maybe your HTML is not generated by umi(like server side rendering by template).
npm install umi-plugin-externals --save-dev
yarn add umi-plugin-externals -D
plugins:'umi-plugin-externals'// options, given an example of 'lodash''lodash': '_' 'local/path/to/lodash'
The key of option is webpack Externals's key, the value of option should be an array.
For the array, the first item is webpack Externals's value(a global variable string is recommended), the second item is the local built module path in file system, you should pre-built the module and set corresponding global variable in the pre-built bundle.