ES6 import – jQuery is not defined

大城市里の小女人 提交于 2019-12-11 10:05:44

问题


I'm using Gulp and Browserify for my build process, except I'm having trouble using third party jQuery plugins – showing error jQuery is not defined

The following is my file structure.

app.js

import $ from 'jquery'
import plugin from 'jquery-plugin'

jquery-plugin.js

(function($) {

    // Plugin code here

}(jQuery));

Any ideas?


回答1:


Maybe you need use './'

import $ from 'jquery' import plugin from './jquery-plugin'

EDITED, my new answer below:

Try this way:

import * as jqueryPlugin from 'jquery-plugin'



来源:https://stackoverflow.com/questions/35894687/es6-import-jquery-is-not-defined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!