split-chunk-loader for webpack
A Webpack bundle-loader that supports bundle loading error callbacks.
Credits
This loader is a fork of the bundle-loader.
The original fork was created in the require-error-handler-webpack-plugin
Installation
require.ensure error handling must be activated in webpack for this loaded to work
Webpack 1.x
npm install require-error-handler-webpack-plugin --save-dev
Follow the instructions for configuring the require-error-handler-webpack-plugin
npm install split-chunk-loader --save-dev
Webpack >= 2.2 < 2.4
npm install require-ensure-error-webpack-plugin --save-dev
Follow the instructions for configuring the require-ensure-error-webpack-plugin
Webpack >= 2.4
The require-ensure-error-webpack-plugin is no longer needed with Webpack 2.4 and above since the feature has been merged into Webpack itself.
npm install split-chunk-loader --save-dev
Usage
// The chunk is requested, when you require itvar waitForChunk = ;// To wait until the chunk is available (and get the exports)// you need to async wait for it.;// wraps the require in a require.ensure block
The file is requested when you require the split chunk loader. If you want it to request it lazily, use:
var load = ;// The chunk is not requested until you call the load function;
You may set the name for the chunk bundle file (name
query parameter). See documentation.
; // #.my-chunk.js; // #.my-chunk-the-file.js
License
MIT (http://www.opensource.org/licenses/mit-license.php)