-
Notifications
You must be signed in to change notification settings - Fork 0
How to include jQuery
npm install jquery --save-dev
typings install dt~jquery --save --global
plugins: [
new webpack.ProvidePlugin({
jQuery: 'jquery',
$: 'jquery',
jquery: 'jquery'
})
]
Note:
If you use vendor modules that depend on jQuery and if all of them don't use the same jQuery version, or if you use jQuery itself and a vendor module that depend on a different jQuery version, all these jQuery versions will be included in the generated vendor bundle.
To avoid this behaviour, you can add some logic to control which jQuery version(s) will be included, by using a webpack null-loader.
npm install null-loader --save-dev
Here we prevent others jQuery versions than the Foundation-sites's one to be included :
module: {
...
loaders: [
...
{
test: /jquery\.js/,
loader: 'null-loader',
exclude: path.resolve('node_modules/foundation-sites/')
}
}
enjoy — AngularClass
Learn AngularJS, Angular 2, and Modern Web Development from the best. Looking for corporate Angular training, want to host us, or Angular consulting? [email protected]