I am using a browser for my angular client application. I need to use underscore. angular is installed with a gazebo and underscore is set with npm number
This is how I launch the browser (npm) and create the source map in gulp (npm)
gulp.task('browserify', function() { return browserify(dir.script_from + '/main.js', {debug: true}) .bundle() .pipe(source('bundle.js')) // gives streaming vinyl file object .pipe(buffer()) // <----- convert from streaming to buffered vinyl file object .pipe(sourcemaps.init({loadMaps: true})) .pipe(uglify()) // now gulp-uglify works .pipe(sourcemaps.write('./')) .pipe(gulp.dest(dir.script_to)); });
In my main.js I have
//require('underscore') require('angular') require('angular-resource') require('angular-route') require('./home/home_page.js') ...
if I do not require ('underscore'), the source map works. I can view the source files and set breakpoints.

But if I require ('underscore'), the source map no longer works. I canβt even browse files.

I also tried to set the underline using bower, but I get the following error:
[23:59:02] Starting 'browserify'... events.js:85 throw er; // Unhandled 'error' event ^ Error: Cannot find module 'underscore' from '/Users/[my path]/app/client/script'
Note that both bower (I config'ed the path) and npm put the modules in the folder "/ Users / [my path] / node_modules"
I even tried main.js with only one line: require('underscore') and did not work, but the empty main.js file works
John
source share