Closed jessedvrs closed 8 years ago
For a second I thought that I would be able to do it using the undocumented threshold (Function) option. Unfortunately, that function gets called for every entry-point, not for every dependency.
@jessedvrs The threshold
function is called for each file being added to the bundle.
Got it working using the threshold option as a function.
var contains = require('mout/array/contains');
...
threshold: function(row, groups) {
return contains([
'node_modules/jquery/dist/jquery.js',
'node_modules/angular/index.js',
'node_modules/moment/moment.js',
'node_modules/moment/locale/nl.js',
'node_modules/angular-resource/index.js',
'node_modules/angular-messages/index.js',
'node_modules/angular-animate/index.js',
'node_modules/angular-sanitize/index.js',
'src/app/cb/index.js'
], row.sourceFile);
}
Only the files specified in the array are being added to my common bundle now. Thanks @terinjokes ;)
Let's say I have a lot of entry-points in my application and only a few entry-points require dependency X. It is somehow possible to exclude X from being considered common? Or better: is it possible to specify which dependencies are added to the common-bundle?
A very strong side of factor-bundle is that it does optimisations while leaving all files unchanged. I would be pleased if I can keep it like that since I am working on a very large scale application.