// the key same to the value, it is not worked! return an empty object {}.
new webpack.ProvidePlugin({
'angular': 'angular'
});
// not same, it is worked!
new webpack.ProvidePlugin({
'ng': 'angular'
});
and there is noting about the key can not the same to the module's name in the office doc .
It does work in general. The problem here is that angular 1 is not working nicely with webpack without a shim (see https://github.com/webpack/webpack/issues/2049 ). Try this webpack loader config, it solved the issue for me, allowing use of ProviderPlugin with the same key as the module name:
module: {
loaders: [
/*
* Necessary to be able to use angular 1 with webpack as explained in https://github.com/webpack/webpack/issues/2049
*/
{
test: require.resolve('angular'),
loader: 'exports?window.angular'
},
]
},
plugins: [
new webpack.ProvidePlugin({
'angular': 'angular',
}),
],
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.