Permalink
Browse files

feat(@ngtools/webpack): allow specifying additional bundles to lazy load

  • Loading branch information...
connor4312 committed Nov 23, 2017
1 parent 6f8967f commit b4bbb8eff0abbe107e49c9b9a9590603ee22c9f2
Showing with 11 additions and 1 deletion.
  1. +1 −1 packages/@ngtools/webpack/package.json
  2. +10 −0 packages/@ngtools/webpack/src/plugin.ts
@@ -1,6 +1,6 @@
{
"name": "@ngtools/webpack",
"version": "1.7.4",
"version": "1.7.5",
"description": "Webpack plugin that AoT compiles your Angular components and modules.",
"main": "./src/index.js",
"typings": "src/index.d.ts",
@@ -35,6 +35,7 @@ export interface AotPluginOptions {
locale?: string;
missingTranslation?: string;
transform?: FileTransform;
additionalBundles?: string[];

// Use tsconfig to include path globs.
exclude?: string | string[];
@@ -571,6 +572,15 @@ export class AotPlugin implements Tapable {
? this._getLazyRoutesFromNgtools()
: this._findLazyRoutesInAst();

if (this._options.additionalBundles) {
this._options.additionalBundles.forEach(ref => {
const [relativePath, module] = ref.split('#');
const absPath = path.resolve(relativePath);
const entryDir = path.dirname(this.entryModule.path);
this._discoveredLazyRoutes[`${path.relative(entryDir, absPath)}#${module}`] = absPath;
});
}

// Process the lazy routes discovered.
Object.keys(this.discoveredLazyRoutes)
.forEach(k => {

0 comments on commit b4bbb8e

Please sign in to comment.