ES6导入– jQuery未定义 [英] ES6 import – jQuery is not defined
本文介绍了ES6导入– jQuery未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在构建过程中使用的是Gulp和Browserify,但我在使用第三方jQuery插件时遇到了麻烦–显示错误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
以下是我的文件结构.
app.js
app.js
import $ from 'jquery'
import plugin from 'jquery-plugin'
jquery-plugin.js
jquery-plugin.js
(function($) {
// Plugin code here
}(jQuery));
有什么想法吗?
推荐答案
也许您需要使用'./'
Maybe you need use './'
import $ from 'jquery'
import plugin from './jquery-plugin'
import $ from 'jquery'
import plugin from './jquery-plugin'
已编辑,下面是我的新答案:
尝试这种方式:
import * as jqueryPlugin from 'jquery-plugin'
import * as jqueryPlugin from 'jquery-plugin'
这篇关于ES6导入– jQuery未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文