1

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?

deleteddeleted
  • 155
  • 1
  • 13
  • 1
    You'll [need to shim](http://stackoverflow.com/questions/21265814/shim-a-jquery-plugin-with-browserify) those modules. Most jQuery plugins don't support UMD/CJS/AMD so Browserify doesn't know how to locate dependencies – CodingIntrigue Mar 09 '16 at 15:21

1 Answers1

-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'

Ricardo Canelas
  • 2,280
  • 26
  • 21