vue-cli3引入jquery的不同
npm install jquery --savevue-cli3 配置;在vue.config.js中module.exports = {// 基本路径baseUrl: './',configureWebpack: {plugins: [new webpack.ProvidePlugin({$:"jquery",jQuery:"jquery&
·
npm install jquery --save
vue-cli3 配置;
在vue.config.js中
module.exports = {
// 基本路径
baseUrl: './',
configureWebpack: {
plugins: [
new webpack.ProvidePlugin({
$:"jquery",
jQuery:"jquery",
"windows.jQuery":"jquery"
})
]
},
lintOnSave: undefined
}
3以下的配置
webpack.base.conf.js
var webpack = require('webpack')
const ProvidePlugin = new webpack.ProvidePlugin({//引入外部类库
$: 'jquery',
jQuery: 'jquery',
});
module.exports = {
...
plugins: [
ProvidePlugin,
],
...
}
或
import $ from 'jquery'
更多推荐
已为社区贡献11条内容
所有评论(0)