I\'m working on ng2 application and I use @angular/cli to build it. As output it emits several js files like .inline.js, .vendor.js et
I have not seen any functionality in angular-cli that builds into one bundle, however, it should be fairly easy to do with a nodejs script or using one of the concat libraries available such as concat-files https://www.npmjs.com/package/concat-files
install concat-files then: add a concat.js file in your project at the same level as dist folder
var concat = require('concat-files');
concat([
'./dist/inline.bundle.js',
'./dist/vendor.bundle.js',
'./dist/vendor.bundle.js'
], './dist/app.js', function(err) {
if (err) throw err
console.log('done');
});
in your package.json under scripts add a new script build:
"scripts":{
"build": "ng build && node concat.js"
}
then run it npm run build it will run the angular cli build first the run the concat.js script which will concatenate the resulting bundles