{"library":"ngx-build-plus","title":"ngx-build-plus","description":"ngx-build-plus is an Angular CLI extension that allows developers to customize the webpack build process without needing to \"eject\" the Angular application. It enables integration of custom webpack configurations or functions, offering a flexible way to modify how Angular projects are built and served. The current stable version is 20.0.0, tightly coupled to Angular CLI 20.x, ensuring compatibility with the latest Angular ecosystem. It typically releases new major versions in alignment with Angular's major releases. Key differentiators include its non-ejecting approach, support for `ng serve` and `ng build` parity, schematics for common advanced use cases like webpack externals, and options for building single bundles, useful for Angular Elements. It provides a simple API for merging partial webpack configurations or using a custom hook function to modify the default CLI webpack config.","language":"javascript","status":"active","last_verified":"Tue Apr 21","install":{"commands":["npm install ngx-build-plus"],"cli":{"name":"ng","version":null}},"imports":["In angular.json: \"builder\": \"ngx-build-plus:browser\"","const webpack = require('webpack');","In angular.json options: \"configHook\": \"path/to/my-webpack-hook.js\""],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const webpack = require('webpack');\n\nmodule.exports = {\n    plugins: [\n        new webpack.DefinePlugin({\n            \"VERSION\": JSON.stringify(\"4711\")\n        })\n    ]\n};\n\n// src/app/app.component.ts\nimport { Component } from '@angular/core';\n\ndeclare const VERSION: string; // Declare global variable defined by webpack\n\n@Component({\n    selector: 'app-root',\n    template: `<h1>{{ title }}</h1>`,\n    styles: ['h1 { color: blue; }']\n})\nexport class AppComponent {\n    title = 'Version: ' + VERSION;\n}\n","lang":"typescript","description":"Demonstrates how to add ngx-build-plus, create a partial webpack configuration (`webpack.partial.js`) to define a global `VERSION` constant, integrate it into an `app.component.ts`, and apply it to an Angular project via `ng serve --extra-webpack-config webpack.partial.js -o` after running `ng add ngx-build-plus`.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}