new webpack.ProvidePlugin({identifier1: 'module1', /* ... */})
Automatically loads modules. Whenever the identifier is encountered as free variable in a module, the module is loaded automatically and the identifier is filled with the exports of the loaded module.
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery'
})
// in a module
$('#item'); // <= just works
jQuery('#item'); // <= just works
// $ is automatically set to the exports of module "jquery"
Angular looks for window.jQuery in order to determine whether jQuery is present, see the source code
new webpack.ProvidePlugin({
'window.jQuery': 'jquery'
})
© 2012–2016 Tobias Koppers
Licensed under the Creative Commons Attribution License 4.0.
https://webpack.js.org/plugins/provide-plugin/