问题描述:

在导入jQuery的时候,没找到index.js,就直接在vue.config.js中添加了,出现的下面的错误
请添加图片描述

原因:未知

解决方法:

在外层加上configureWebpack

const path = require('path')

var webpack = require('webpack')


function resolve(dir) {
    return path.join(__dirname, dir)
}
module.exports = {
    configureWebpack: {
        plugins: [
            new webpack.ProvidePlugin({
                $: "jquery",
                jQuery: "jquery",
                "windows.jQuery": "jquery"
            })
        ]
    }
}
Logo

前往低代码交流专区

更多推荐