ngryman / gulp-bro

:punch: gulp + browserify + incremental build, done right.
MIT License
122 stars 13 forks source link

Using with browserify-shim #47

Closed ilicmarko closed 6 years ago

ilicmarko commented 6 years ago

How would you globaly include lets say jQuery. Here is what currently I am testing:

gulpfile.js

gulp.src('src/scripts/app.js')
    .pipe(bro({
      transform: [['browserify-shim' , { global: true }]]
    }))
    .pipe(gulp.dest('.tmp/scripts'))
    .pipe(reload({stream: true}));

package.json

"dependencies": {
    "browserify-shim": "^3.8.14",
    "jquery": "^3.3.1",
    "select2": "select2/select2",
  },
  "browserify": {
    "transform": [
      "browserify-shim"
    ]
  },
  "browserify-shim": {
    "jquery": "global:jQuery"
  }

I am currently trying to implement select2 and I am having problems.

ngryman commented 6 years ago

Hi @ilicmarko! I'm unfortunately not actively using browserify anymore so I don't exactly remember the answer to this question, sorry...

I guess the problem you have here is that browserify-shim is not reading correctly you package.json? Have you tried to pass the config as an argument to the transform?

ilicmarko commented 6 years ago

I think I got it working at one point and then I gave up switch to webpack