ng-annotate-webpack-plugin
raw JSON → 0.3.0 verified Sat Apr 25 auth: no javascript maintenance
A webpack plugin that runs ng-annotate on your bundles to add dependency injection annotations for AngularJS. Stable version is 0.3.0. Designed for AngularJS (1.x) applications using Webpack. Alternative to ng-annotate-loader. Provides plugin-based approach; can be used with other loaders. No active development or recent updates (last release 0.3.0). Not intended for Angular 2+.
Common errors
error Module not found: Error: Can't resolve 'ng-annotate-webpack-plugin' ↓
cause Missing npm install or incorrect path.
fix
npm install ng-annotate-webpack-plugin --save-dev
error TypeError: ngAnnotatePlugin is not a constructor ↓
cause Incorrect import (default import instead of require).
fix
Use require('ng-annotate-webpack-plugin') instead of ES6 import.
Warnings
deprecated Consider using ng-annotate-loader instead — this plugin may not be maintained. ↓
fix Switch to ng-annotate-loader for better integration with webpack loaders.
gotcha Plugin runs ng-annotate after bundling — source maps may be incorrect. ↓
fix Consider using ng-annotate-loader which processes before bundling.
Install
npm install ng-annotate-webpack-plugin yarn add ng-annotate-webpack-plugin pnpm add ng-annotate-webpack-plugin Imports
- ngAnnotatePlugin wrong
import ngAnnotatePlugin from 'ng-annotate-webpack-plugin';correctvar ngAnnotatePlugin = require('ng-annotate-webpack-plugin');
Quickstart
// webpack.config.js
var ngAnnotatePlugin = require('ng-annotate-webpack-plugin');
module.exports = {
// ... rest of config
plugins: [
new ngAnnotatePlugin({
add: true
// other ng-annotate options here
})
]
};