Registry / web-framework / ngc-webpack

ngc-webpack

JSON →
library4.1.2jsnpmunverified

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.

npm install ngc-webpack
INSTALL
IMPORT
SIG · NGC-WEBPACK
N
ngc-webpack
web-frameworkjavascriptv4.1.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

NgcWebpackPlugin
import { NgcWebpackPlugin } from 'ngc-webpack'
const NgcWebpackPlugin = require('ngc-webpack').NgcWebpackPlugin
CommonJS works but TypeScript types expect named import.
NgcWebpackPluginOptions
import { NgcWebpackPluginOptions } from 'ngc-webpack'
const NgcWebpackPluginOptions = require('ngc-webpack').NgcWebpackPluginOptions
Mainly used for TypeScript type checking.
NgcWebpackLoader
import { NgcWebpackLoader } from 'ngc-webpack'
Used to configure webpack rules with the Angular AOT loader.

Basic webpack configuration using NgcWebpackPlugin as a replacement for @ngtools/webpack AngularWebpackPlugin.

// webpack.config.js const { NgcWebpackPlugin } = require('ngc-webpack'); module.exports = { entry: './src/main.ts', module: { rules: [ { test: /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/, use: [ { loader: '@ngtools/webpack' } ] } ] }, plugins: [ new NgcWebpackPlugin({ tsConfigPath: './tsconfig.json', mainPath: './src/main.ts' }) ] };
Debug
Known issues
breakingVersion 4.0.0 removed support for custom TypeScript loaders like ts-loader and awesome-typescript-loader.
fix
Use @ngtools/webpack loader exclusively.
affects: >=4.0.0
deprecatedLibrary mode is considered experimental and may not work with newer Angular versions.
fix
Consider using Angular CLI's library generation or ng-packagr.
affects: >=4.0.0
gotchangc-webpack does not support Angular Ivy; it is tied to the View Engine compiler.
fix
Do not use with Angular 9+; use @ngtools/webpack with Ivy at your own risk.
affects: >=4.0.0
Errors
Common errors & fixes
Error: Cannot find module '@angular/compiler-cli'
Missing peer dependency @angular/compiler-cli.
fix
Run npm install @angular/compiler-cli@^5.0.0
Error: The Angular Compiler requires TypeScript >=2.1 and <2.5.
TypeScript version incompatible with Angular 5 compiler.
fix
Install TypeScript 2.4.x with npm install typescript@2.4
TypeError: NgcWebpackPlugin is not a constructor
Incorrect import style (default vs named).
fix
Use import { NgcWebpackPlugin } from 'ngc-webpack'; or const { NgcWebpackPlugin } = require('ngc-webpack');
Upgrade
Version history
4.1.2latest on npm
Audit
Dependencies
@ngtools/webpackrequiredCore webpack plugin for Angular AOT compilation
@angular/compiler-clirequiredAngular compiler CLI required for AOT
Agent activity
4 hits · last 30 days
node
4
Resources
ngc-webpack — npm install ngc-webpack · libregistry