jackfranklin / gulp-load-plugins

Automatically load in gulp plugins
https://github.com/jackfranklin/gulp-load-plugins
MIT License
757 stars 55 forks source link

gulp-load-plugins and browserify formatError #44

Closed newtonianb closed 10 years ago

newtonianb commented 10 years ago

gulp version: 3.8.9 node version: 0.10.32 gulp-load-plugins version: "gulp-load-plugins": "^0.7.0",

Here is my gulp task

var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
gulp.task('browserify', function (callback) {

    var bundleQueue = config.configs.length;

    var browserifyThis = function (bundleConfig) {

        var bundler = $.browserify({

I get the following error:

[19:42:13] 'build' errored after 15 ms
[19:42:13] Error: [object Object]
  at formatError (c:\Users\Dere\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:169:10)
  at Gulp.<anonymous> (c:\Users\Dere\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:195:15)
  at Gulp.emit (events.js:117:20)
  at Gulp.Orchestrator._emitTaskDone (C:\project\node_modules\gulp\node_modules\orchestrator\index.js:264:8)
  at C:\project\node_modules\gulp\node_modules\orchestrator\index.js:275:23
  at finish (C:\project\node_modules\gulp\node_modules\orchestrator\lib\runTask.js:21:8)
  at cb (C:\project\node_modules\gulp\node_modules\orchestrator\lib\runTask.js:29:3)
  at finish (C:\project\node_modules\run-sequence\index.js:38:5)
  at Gulp.onError (C:\project\node_modules\run-sequence\index.js:45:4)
  at Gulp.emit (events.js:117:20)
  at Gulp.Orchestrator._emitTaskDone (C:\project\node_modules\gulp\node_modules\orchestrator\index.js:264:8)
  at C:\project\node_modules\gulp\node_modules\orchestrator\index.js:275:23
  at finish (C:\project\node_modules\gulp\node_modules\orchestrator\lib\runTask.js:21:8)
  at module.exports (C:\project\node_modules\gulp\node_modules\orchestrator\lib\runTask.js:36:10)
  at Gulp.Orchestrator._runTask (C:\project\node_modules\gulp\node_modules\orchestrator\index.js:273:3)
  at Gulp.Orchestrator._runStep (C:\project\node_modules\gulp\node_modules\orchestrator\index.js:214:10)
  at Gulp.Orchestrator.start (C:\project\node_modules\gulp\node_modules\orchestrator\index.js:134:8)
  at runNextSet (C:\project\node_modules\run-sequence\index.js:64:16)
  at Gulp.onTaskEnd (C:\project\node_modules\run-sequence\index.js:53:5)
  at Gulp.emit (events.js:117:20)
  at Gulp.Orchestrator._emitTaskDone (C:\project\node_modules\gulp\node_modules\orchestrator\index.js:264:8)
  at C:\project\node_modules\gulp\node_modules\orchestrator\index.js:275:23
  at finish (C:\project\node_modules\gulp\node_modules\orchestrator\lib\runTask.js:21:8)
  at cb (C:\project\node_modules\gulp\node_modules\orchestrator\lib\runTask.js:29:3)
  at module.exports (C:\project\node_modules\del\node_modules\each-async\index.js:22:3)
  at C:\project\node_modules\del\index.js:34:3
  at C:\project\node_modules\del\node_modules\globby\node_modules\async\lib\async.js:277:13
  at C:\project\node_modules\del\node_modules\globby\node_modules\async\lib\async.js:157:25
  at C:\project\node_modules\del\node_modules\globby\node_modules\async\lib\async.js:274:17
  at C:\project\node_modules\del\node_modules\globby\index.js:38:4
  at f (C:\project\node_modules\del\node_modules\globby\node_modules\glob\node_modules\once\once.js:17:25)
  at Glob.<anonymous> (C:\project\node_modules\del\node_modules\globby\node_modules\glob\glob.js:98:7)
  at Glob.emit (events.js:95:17)
  at Glob.next (C:\project\node_modules\del\node_modules\globby\node_modules\glob\glob.js:355:10)
  at Glob._processEmitQueue (C:\project\node_modules\del\node_modules\globby\node_modules\glob\glob.js:320:12)
  at Glob.emitMatch (C:\project\node_modules\del\node_modules\globby\node_modules\glob\glob.js:300:8)
  at Glob._finish (C:\project\node_modules\del\node_modules\globby\node_modules\glob\glob.js:240:8)
  at Glob.<anonymous> (C:\project\node_modules\del\node_modules\globby\node_modules\glob\glob.js:193:27)
  at Glob.cb (C:\project\node_modules\del\node_modules\globby\node_modules\glob\glob.js:378:11)
  at Glob.<anonymous> (C:\project\node_modules\del\node_modules\globby\node_modules\glob\glob.js:542:17)
  at Glob._afterReaddir (C:\project\node_modules\del\node_modules\globby\node_modules\glob\glob.js:706:15)
  at ReaddirReq.Req.done (C:\project\node_modules\del\node_modules\globby\node_modules\glob\node_modules\graceful-fs\graceful-fs.js:141:5)
  at ReaddirReq.done (C:\project\node_modules\del\node_modules\globby\node_modules\glob\node_modules\graceful-fs\graceful-fs.js:88:22)
  at Object.oncomplete (evalmachine.<anonymous>:107:15)

In this format $.browserify does not work.

jackfranklin commented 10 years ago

@newtonianb can you show me your package.json file? Browserify isn't a gulp plugin, so I wouldn't expect this plugin to load it in.

newtonianb commented 10 years ago

ah very cool I just found out about pattern, thank you

var plugins = gulpLoadPlugins({
  pattern: 'browserify**'
});
jackfranklin commented 10 years ago

@newtonianb glad you got it working, however I wouldn't recommend loading non gulp plugins with this plugin.

havenchyk commented 9 years ago

@jackfranklin, could you clarify, why you wouldn't recommend to load non gulp plugins?

jackfranklin commented 9 years ago

Because it's not designed to. Of course you can do it, at its core this plugin is one for auto loading modules of a particular pattern (and I've pondered abstracting that out) but it's designed to work specifically with gulp plugins.

I also happen to like the very expressive var x = require('x'); at the top of my Node files and wouldn't want to lose that in favour of using this project.