1.0.0 • Published 6 years ago

angular-builders v1.0.0

Weekly downloads
79
License
MIT
Repository
github
Last release
6 years ago

angular-cli-builders

A set of additional builders for angular-cli

Prerequsits:

  • Angular CLI 6
  • @angular-devkit/architect >= 0.7.0-rc.0
  • @angular-devkit/build-angular >= 0.7.0-rc.0
  • @angular-devkit/build-webpack >= 0.7.0-rc.0

Usage

  1. npm i -D angular-cli-builders
  2. In your angular.json:
    ...
    "architect": {
           ...
           "[architect-target]": {
                     "builder": "angular-builders:[name-of-builder]"
                     "options": {
                           ...
                     }
    Where:
  3. ng [architect-target]

    For example

  • angular.json:
    "architect": {
        ...
        "build": {
                  "builder": "angular-builders:custom-webpack-browser"
                  "options": {
                        ...
                  }
  • Run the build: ng build

Builders

custom-webpack-browser

Extended @angular-devkit/build-angular:browser builder that allows to specify additional webpack configuration (on top of the existing under the hood).
The builder will run the same build as @angular-devkit/build-angular:browser does with extra parameters that are specified in the provided webpack configuration.

Options:

  • All the @angular-devkit/build-angular:browser options
  • webpackConfigPath: path to the extra webpack configuration, defaults to webpack.config.js

angular.json Example:

"architect": {
    ...
    "build": {
              "builder": "angular-builders:custom-webpack-browser"
              "options": {
                     "webpackConfigPath": "./extra-webpack.config.js",
                     "outputPath": "dist/my-cool-library",
                     "index": "src/index.html",
                     "main": "src/main.ts",
                     "polyfills": "src/polyfills.ts",
                     "tsConfig": "src/tsconfig.app.json"
              }

custom-webpack-server

Extended @angular-devkit/build-angular:server builder that allows to specify additional webpack configuration (on top of the existing under the hood).
The builder will run the same build as @angular-devkit/build-angular:server does with extra parameters that are specified in the provided webpack configuration.

Options:

  • All the @angular-devkit/build-angular:server options
  • webpackConfigPath: path to the extra webpack configuration, defaults to webpack.config.js

angular.json Example:

"architect": {
    ...
    "build": {
              "builder": "angular-builders:custom-webpack-server"
              "options": {
                     "webpackConfigPath": "./extra-webpack.config.js",
                     "outputPath": "dist/my-cool-library",
                     "index": "src/index.html",
                     "main": "src/main.ts",
                     "polyfills": "src/polyfills.ts",
                     "tsConfig": "src/tsconfig.app.json"
              }