简体   繁体   中英

ES6 import – jQuery is not defined

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?

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'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM