Skip to content

Commit f22a96d

Browse files
committed
fix(bundle): allow apps to specify bundles
1 parent b92b236 commit f22a96d

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

lib/broccoli/angular-broccoli-bundle.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,18 @@ class BundlePlugin extends Plugin {
1616
build() {
1717
var relativeRoot = path.relative(process.cwd(), this.inputPaths[0]);
1818
var builder = new Builder(relativeRoot, `${relativeRoot}/system-config.js`);
19-
return builder.bundle('main - [app/**/*]',
19+
const bundles = this.options.bundles || ['app'];
20+
21+
return builder.bundle('main' + bundles.map(name => ` - [${name}/**/*]`).join(''),
2022
`${this.outputPath}/main.js`, {
2123
minify: true
2224
})
23-
.then(() => builder.bundle('app - (app/**/*.js - [app/**/*.js])',
24-
`${this.outputPath}/app/index.js`, {
25-
minify: true
26-
}))
25+
.then(() => Promise.all(bundles.map(bundleName => {
26+
return builder.bundle(`${bundleName} - (${bundleName}/**/*.js - [${bundleName}/**/*.js])`,
27+
`${this.outputPath}/${bundleName}/index.js`, {
28+
minify: true
29+
});
30+
})))
2731
.then(() => fse.copySync(`${this.inputPaths[0]}/system-config.js`,
2832
`${this.outputPath}/system-config.js`));
2933
}

lib/broccoli/angular2-app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ class Angular2App extends BroccoliPlugin {
418418
include: ['**/*.js', '**/*.js.map']
419419
});
420420

421-
var bundleTree = new BundlePlugin([jsTree]);
421+
var bundleTree = new BundlePlugin([jsTree], this._options.bundle);
422422

423423
if (this.ngConfig.apps[0].mobile) {
424424
bundleTree = concat(BroccoliMergeTrees([vendorTree, jsTree, scriptTree, bundleTree], {

0 commit comments

Comments
 (0)