{"id":20236,"library":"ngc-webpack","title":"ngc-webpack","description":"A wrapper around @ngtools/webpack that adds hooks into the Angular AOT compilation process and supports library mode compilation for Angular libraries, enabling resource inlining (SCSS, LESS) and webpack loader chains. Current version 4.1.2 targets Angular 5 and requires @angular/compiler-cli ^5.0.0 and @ngtools/webpack ^1.8.0. The key differentiator from @ngtools/webpack is its library mode for publishing Angular packages, its extensible hook system, and the ability to use a custom TypeScript loader for JIT mode. It is now in maintenance mode; users are generally advised to use @ngtools/webpack directly for application builds unless library compilation is needed. Release cadence is low; last release was 2018.","status":"maintenance","version":"4.1.2","language":"javascript","source_language":"en","source_url":"https://github.com/shlomiassaf/ngc-webpack","tags":["javascript","angular","compiler","webpack","laoder","plugin","typescript"],"install":[{"cmd":"npm install ngc-webpack","lang":"bash","label":"npm"},{"cmd":"yarn add ngc-webpack","lang":"bash","label":"yarn"},{"cmd":"pnpm add ngc-webpack","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core webpack plugin for Angular AOT compilation","package":"@ngtools/webpack","optional":false},{"reason":"Angular compiler CLI required for AOT","package":"@angular/compiler-cli","optional":false}],"imports":[{"note":"CommonJS works but TypeScript types expect named import.","wrong":"const NgcWebpackPlugin = require('ngc-webpack').NgcWebpackPlugin","symbol":"NgcWebpackPlugin","correct":"import { NgcWebpackPlugin } from 'ngc-webpack'"},{"note":"Mainly used for TypeScript type checking.","wrong":"const NgcWebpackPluginOptions = require('ngc-webpack').NgcWebpackPluginOptions","symbol":"NgcWebpackPluginOptions","correct":"import { NgcWebpackPluginOptions } from 'ngc-webpack'"},{"note":"Used to configure webpack rules with the Angular AOT loader.","wrong":"","symbol":"NgcWebpackLoader","correct":"import { NgcWebpackLoader } from 'ngc-webpack'"}],"quickstart":{"code":"// webpack.config.js\nconst { NgcWebpackPlugin } = require('ngc-webpack');\n\nmodule.exports = {\n  entry: './src/main.ts',\n  module: {\n    rules: [\n      {\n        test: /(?:\\.ngfactory\\.js|\\.ngstyle\\.js|\\.ts)$/,\n        use: [\n          { loader: '@ngtools/webpack' }\n        ]\n      }\n    ]\n  },\n  plugins: [\n    new NgcWebpackPlugin({\n      tsConfigPath: './tsconfig.json',\n      mainPath: './src/main.ts'\n    })\n  ]\n};","lang":"javascript","description":"Basic webpack configuration using NgcWebpackPlugin as a replacement for @ngtools/webpack AngularWebpackPlugin."},"warnings":[{"fix":"Use @ngtools/webpack loader exclusively.","message":"Version 4.0.0 removed support for custom TypeScript loaders like ts-loader and awesome-typescript-loader.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Consider using Angular CLI's library generation or ng-packagr.","message":"Library mode is considered experimental and may not work with newer Angular versions.","severity":"deprecated","affected_versions":">=4.0.0"},{"fix":"Do not use with Angular 9+; use @ngtools/webpack with Ivy at your own risk.","message":"ngc-webpack does not support Angular Ivy; it is tied to the View Engine compiler.","severity":"gotcha","affected_versions":">=4.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run npm install @angular/compiler-cli@^5.0.0","cause":"Missing peer dependency @angular/compiler-cli.","error":"Error: Cannot find module '@angular/compiler-cli'"},{"fix":"Install TypeScript 2.4.x with npm install typescript@2.4","cause":"TypeScript version incompatible with Angular 5 compiler.","error":"Error: The Angular Compiler requires TypeScript >=2.1 and <2.5."},{"fix":"Use import { NgcWebpackPlugin } from 'ngc-webpack'; or const { NgcWebpackPlugin } = require('ngc-webpack');","cause":"Incorrect import style (default vs named).","error":"TypeError: NgcWebpackPlugin is not a constructor"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}