mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-23 23:59:27 +08:00
refactor(@ngtools/webpack): simplify a call using await
This commit is contained in:
parent
55a86c99ab
commit
8d82e9812d
@ -760,39 +760,36 @@ export class AngularCompilerPlugin {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.done.then(
|
await this.done;
|
||||||
() => {
|
|
||||||
// This folder does not exist, but we need to give webpack a resource.
|
|
||||||
// TODO: check if we can't just leave it as is (angularCoreModuleDir).
|
|
||||||
result.resource = path.join(this._basePath, '$$_lazy_route_resource');
|
|
||||||
// tslint:disable-next-line:no-any
|
|
||||||
result.dependencies.forEach((d: any) => d.critical = false);
|
|
||||||
// tslint:disable-next-line:no-any
|
|
||||||
result.resolveDependencies = (_fs: any, options: any, callback: Callback) => {
|
|
||||||
const dependencies = Object.keys(this._lazyRoutes)
|
|
||||||
.map((key) => {
|
|
||||||
const modulePath = this._lazyRoutes[key];
|
|
||||||
if (modulePath !== null) {
|
|
||||||
const name = key.split('#')[0];
|
|
||||||
|
|
||||||
return new this._contextElementDependencyConstructor(modulePath, name);
|
// This folder does not exist, but we need to give webpack a resource.
|
||||||
} else {
|
// TODO: check if we can't just leave it as is (angularCoreModuleDir).
|
||||||
return null;
|
result.resource = path.join(this._basePath, '$$_lazy_route_resource');
|
||||||
}
|
// tslint:disable-next-line:no-any
|
||||||
})
|
result.dependencies.forEach((d: any) => d.critical = false);
|
||||||
.filter(x => !!x);
|
// tslint:disable-next-line:no-any
|
||||||
|
result.resolveDependencies = (_fs: any, options: any, callback: Callback) => {
|
||||||
|
const dependencies = Object.keys(this._lazyRoutes)
|
||||||
|
.map((key) => {
|
||||||
|
const modulePath = this._lazyRoutes[key];
|
||||||
|
if (modulePath !== null) {
|
||||||
|
const name = key.split('#')[0];
|
||||||
|
|
||||||
if (this._options.nameLazyFiles) {
|
return new this._contextElementDependencyConstructor(modulePath, name);
|
||||||
options.chunkName = '[request]';
|
} else {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.filter(x => !!x);
|
||||||
|
|
||||||
callback(null, dependencies);
|
if (this._options.nameLazyFiles) {
|
||||||
};
|
options.chunkName = '[request]';
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
callback(null, dependencies);
|
||||||
},
|
};
|
||||||
() => undefined,
|
|
||||||
);
|
return result;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user