{"id":20234,"library":"ng-annotate-loader","title":"ng-annotate-loader","description":"A webpack loader that automatically adds AngularJS dependency injection annotations to your source code using ng-annotate. Version 0.7.0 is the latest stable release. It generates source maps by default and supports chaining with other loaders like babel-loader. Key features include passing ng-annotate options (add, map, etc.), using ng-annotate plugins, and specifying a custom ng-annotate fork. This loader is specific to AngularJS (1.x) and webpack 1.x/2.x/3.x; for newer Angular versions, consider using the Angular CLI or other DI mechanisms.","status":"active","version":"0.7.0","language":"javascript","source_language":"en","source_url":"https://github.com/huston007/ng-annotate-loader","tags":["javascript","webpack","ng-annotate","angular"],"install":[{"cmd":"npm install ng-annotate-loader","lang":"bash","label":"npm"},{"cmd":"yarn add ng-annotate-loader","lang":"bash","label":"yarn"},{"cmd":"pnpm add ng-annotate-loader","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core annotation library; the loader invokes ng-annotate to process files.","package":"ng-annotate","optional":false}],"imports":[{"note":"This loader is typically used via webpack config, not imported directly.","wrong":"const ngAnnotateLoader = require('ng-annotate-loader')","symbol":"default","correct":"import ngAnnotateLoader from 'ng-annotate-loader'"}],"quickstart":{"code":"// webpack.config.js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.js$/,\n        use: [\n          {\n            loader: 'ng-annotate-loader',\n            options: {\n              add: true,\n              map: false\n            }\n          },\n          'babel-loader'\n        ]\n      }\n    ]\n  }\n};","lang":"javascript","description":"Configures webpack to run ng-annotate-loader before babel-loader on JavaScript files, enabling automatic AngularJS DI annotation."},"warnings":[{"fix":"Replace with babel-plugin-angularjs-annotate in your babel configuration.","message":"ng-annotate itself is no longer actively maintained. For AngularJS (1.x), consider using babel-plugin-angularjs-annotate instead.","severity":"deprecated","affected_versions":">=0.7.0"},{"fix":"Use webpack 3 or earlier, or check for a maintained fork.","message":"Webpack 4+ changed the loader invocation method. This loader may not work with webpack 4 without configuration.","severity":"breaking","affected_versions":"0.6.0 - 0.7.0"},{"fix":"Ensure ng-annotate-loader appears before babel-loader in the rules array.","message":"Chaining loaders: ng-annotate-loader must run before other transpilers (e.g., babel) to avoid syntax errors from ng-annotate injecting code that isn't transpiled.","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install --save-dev ng-annotate-loader' and ensure it's in your package.json.","cause":"ng-annotate-loader is not installed or the path is incorrect.","error":"Module not found: Error: Cannot resolve module 'ng-annotate-loader'"},{"fix":"Make sure 'ng-annotate' is installed: 'npm install --save-dev ng-annotate'.","cause":"The loader cannot resolve the 'ng-annotate' dependency.","error":"ERROR in ng-annotate-loader: Could not find ng-annotate module"},{"fix":"Install a compatible version: 'npm install source-map@0.5.6'.","cause":"Incompatible version of source-map maybe installed.","error":"Source map issue: source-map library version mismatch"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}