Add Jquery to Vue-Cli 3

后端 未结 3 1501
伪装坚强ぢ
伪装坚强ぢ 2020-12-30 07:53

I\'m currently trying to add Jquery to my vue-cli project. I am aware of the missbehaviour it can produce, but anyway; Since there is no build/webpack.bas

3条回答
  •  遥遥无期
    2020-12-30 08:48

    #2 You forget to add configureWebpack into vue.config.js

    const webpack = require('webpack')
    module.exports = {
      configureWebpack: {
        plugins: [
          new webpack.ProvidePlugin({
            $: 'jquery',
            jquery: 'jquery',
            'window.jQuery': 'jquery',
            jQuery: 'jquery'
          })
        ]
      },
    }
    

提交回复
热议问题