angular-cli-builders
Version:
A set of additional builders for angular-cli
28 lines • 1.72 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const build_angular_1 = require("@angular-devkit/build-angular");
const operators_1 = require("rxjs/operators");
const generic_webpack_builder_1 = require("../generic-webpack-builder");
class GenericDevServerBuilder extends build_angular_1.DevServerBuilder {
constructor(context) {
super(context);
}
run(builderConfig) {
const architect = this.context.architect;
const [project, target, configuration] = builderConfig.options.browserTarget.split(':');
const targetSpec = { project, target, configuration };
const targetConfig = architect.getBuilderConfiguration(targetSpec);
// Before we run the dev server grab the target builder so that we have it synchronously
// when we're ready to build the webpack config.
return architect.getBuilderDescription(targetConfig).pipe(operators_1.tap((targetDescription) => this.targetBuilder = architect.getBuilder(targetDescription, this.context)), operators_1.switchMap(() => super.run(builderConfig)));
}
buildWebpackConfig(root, projectRoot, host, browserOptions) {
// Check if we can use the generic webpack builder if so lets use it, otherwise we'll fall back to the DevServerBuilder's
// implementation
return (generic_webpack_builder_1.GenericWebpackBuilder.buildWebpackConfig(this.targetBuilder, root, projectRoot, host, browserOptions) ||
super.buildWebpackConfig(root, projectRoot, host, browserOptions));
}
}
exports.GenericDevServerBuilder = GenericDevServerBuilder;
exports.default = GenericDevServerBuilder;
//# sourceMappingURL=index.js.map