I created a vuejs2 project with latest vue-cli and tried to import jQuery into the project by using expose-loader, I think I followed the instruction in the official readme but got no luck.
What I've done:
- install jquery and expose-loader via npm
- insert the lines below in
build/webpack.base.conf.js
But when I typed console.log(window.jQuery)
in Chrome devtool's console, I still got undefined.
// ...
module: {
rules: [
// added for supporting jquery
{
test: require.resolve('jquery'),
use: [{
loader: 'expose-loader',
options: 'jQuery'
},{
loader: 'expose-loader',
options: '$'
}]
},
// ...
What did I miss?