eugeneware / debowerify

A browserify transform to enable the easy use of bower components in browserify client javascript projects. This can be used in conjunction with deamdify to require AMD components from bower as well.
493 stars 51 forks source link

Debowerify doesn't seems to work #48

Open kopax opened 9 years ago

kopax commented 9 years ago

I have installed through bower

$ bower install bootstrap-daterangepicker --save-dev

In my app.js, I try to include it with

var rangePicker = require('bootstrap3-daterangepicker');

Please not that the bower_components is into the folder ./client/ but I have a .bowerrc file with

{ "cwd": "client" }

The bower.json of this library as all the required attributes. (see : https://github.com/dangrossman/bootstrap-daterangepicker/blob/master/bower.json )

Gulp is in charge to do the browserify bundle for me, but I can't make it work, I always got this error :

[18:06:53] Browserify Error { [Error: Cannot find module 'bootstrap3-daterangepicker' from ...

Any suggestion on how to debug this ?

goodbomb commented 9 years ago

I'm running into this issue right now with angular. Did you ever find a solution?

bobthecow commented 9 years ago

Try this:

var rangePicker = require('bootstrap3-daterangepicker/daterangepicker.js');

and see if it works?

goodbomb commented 9 years ago

I managed to sort out my own issue last. It would seem I was using browserify's "require" method incorrectly. I had upgraded from an earlier version of Browserify and my build broke. I was doing this:

vendorFiles.forEach(function(lib) {
        b.require(lib);
});

But what I actually had to do was this:

var b = browserify({
        require: vendorFiles
});

I was externalizing the vendor files into a separate build and transforming them with debowerify, but I kept getting "Unable to find module 'libs/angular/angular.js' " even though the path resolved correctly. It all works now. Thanks!