I finally figured how to do it for bower components (haven't tested yet for npm modules).
First, the libs browserify task (using TweenMax for the example) :
libs: {
files: {
'build/public/libs.js': ['bower_components/greensock/src/minified/TweenMax.min.js']
},
options: {
shim: {
TweenMax: {
path: 'bower_components/greensock/src/minified/TweenMax.min.js',
exports: 'TweenMax'
}
}
}
}
Then the application task:
dev: {
files: {
'build/public/desktop/desktop.js': ['src/desktop/**/*.js']
},
options: {
external: ['TweenMax']
}
}
It's important to make shims or aliases for each library. When I first tried to make an external bundle, I was using several browserify transforms (such as debowerify/deglobalify) that were interfering with the external thing.