Adds error callback to require.ensure and AMD require calls.
NOTE: Split point error handling was landed in Webpack 2 via
System.import
so I'd strongly advise against using this plugin.
var requireErrorHandlerPlugin = require('require-error-handler-webpack-plugin');
var JsonpMainTemplatePlugin = require('webpack/lib/JsonpMainTemplatePlugin');
{
plugins: [
// `JsonpMainTemplatePlugin` is neccesary as it must be monkey patched.
new requireErrorHandlerPlugin.JsonpErrorHandlerPlugin(JsonpMainTemplatePlugin),
new requireErrorHandlerPlugin.RequireEnsureErrorHandlerPlugin(),
new requireErrorHandlerPlugin.AMDRequireErrorHandlerPlugin()
]
}
Adds an error callback to the jsonp transport method that is called when a chunk fails to load.
NOTE: This depends on the JsonpTemplatePlugin
being applied (webpack does this by default given a target of 'web' or 'node-webkit').
Adds support for the following signatures:
require.ensure(['a'], function() {
// success
}, function() {
// error
}, 'a');
require.ensure(['b'], function() {
// success
}, function() {
// error
});
require.ensure(['c'], function() {
// success
}, 'c');
require.ensure(['d'], function() {
// success
});
NOTE: This depends on the RequireEnsurePlugin
being applied (webpack does this by default).
Adds support for the following signatures:
require(['c'], function() {
// success
}, function() {
// error
});
require(['b'], function() {
// success
});
require(['a']);
NOTE: This depends on the AMDRequirePlugin
being applied (webpack does this by default).
Adds an error callback to the bundle loader, e.g.
// Supports both immediate and lazy requires.
var bundle = require("require-error-handler-webpack-plugin/src/BundleLoader!./file.js");
bundle(function(file) {
// success
}, function() {
// errror
});
- Update
bundle-loader
to support newrequire.ensure
syntax. - Work out how to alias the loader to 'bundle' and carry across query params.
- Add support for default wrapper when chunks are merged
- Add support for named chunks using AMD, i.e. require(name?, deps, successCallback?, errorCallback?)
- Work out how this can occur and support it.
- Remove hacks required to get this to work by potentially requesting changes to webpack to make it easier to hook in.