{"id":19023,"library":"babel-plugin-angular2-annotations","title":"babel-plugin-angular2-annotations","description":"An experimental Babel transformer plugin for Angular 2 decorators and type annotations. Version 5.1.0 (last released in 2016) is the latest stable version, but the project is effectively abandoned with no updates since. It requires babel-plugin-transform-decorators-legacy for decorator support and transforms Flow-style type annotations into Angular's design:paramtypes metadata for dependency injection. Unlike the official Angular compiler, this plugin allowed using Angular 2 with Babel/Flow instead of TypeScript. However, it only supports Angular 2.x and has known issues with newer Angular versions and strict mode.","status":"abandoned","version":"5.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/shuhei/babel-plugin-angular2-annotations","tags":["javascript","es6","es2015","babel","babel-plugin","angular","angular2","ng2","annotation"],"install":[{"cmd":"npm install babel-plugin-angular2-annotations","lang":"bash","label":"npm"},{"cmd":"yarn add babel-plugin-angular2-annotations","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-plugin-angular2-annotations","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for decorator support","package":"babel-plugin-transform-decorators-legacy","optional":false}],"imports":[{"note":"This is a Babel plugin, not an imported module. Configure it in .babelrc or babel.config.js as 'angular2-annotations'.","wrong":"","symbol":"babel-plugin-angular2-annotations","correct":"install and configure in .babelrc"}],"quickstart":{"code":"npm install --save-dev babel-plugin-angular2-annotations babel-plugin-transform-decorators-legacy babel-plugin-transform-class-properties babel-plugin-transform-flow-strip-types babel-preset-es2015\n\n// .babelrc\n{\n  \"plugins\": [\n    \"angular2-annotations\",\n    \"transform-decorators-legacy\",\n    \"transform-class-properties\",\n    \"transform-flow-strip-types\"\n  ],\n  \"presets\": [\n    \"es2015\"\n  ]\n}","lang":"javascript","description":"Installs the plugin and other required Babel plugins, then configures them in .babelrc to transpile Angular 2 decorators and type annotations."},"warnings":[{"fix":"","message":"Plugin does not compile with strict mode","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"npm install reflect-metadata and import it in your app","message":"Requires reflect-metadata polyfill","severity":"gotcha","affected_versions":">=5.0.0"},{"fix":"Migrate to Angular's official compiler or ngc","message":"Project is abandoned and unmaintained; may not work with Babel 7+ or Angular 4+","severity":"deprecated","affected_versions":">=5.0.0"},{"fix":"List 'angular2-annotations' before 'transform-decorators-legacy' in .babelrc","message":"Decorator ordering matters: angular2-annotations must come before transform-decorators-legacy in plugins list","severity":"gotcha","affected_versions":">=5.0.0"},{"fix":"Provide an initializer (even undefined) for class properties","message":"Class property decorators without initializer are handled but produce degraded output on class prototype","severity":"gotcha","affected_versions":">=5.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 --save-dev babel-plugin-angular2-annotations","cause":"Plugin not installed or not listed in node_modules","error":"Error: Cannot find module 'babel-plugin-angular2-annotations'"},{"fix":"Add 'transform-decorators-legacy' to plugins list in .babelrc","cause":"Decorator syntax not supported by Babel without transform-decorators-legacy plugin","error":"SyntaxError: Unexpected token @"},{"fix":"Install reflect-metadata (npm install reflect-metadata) and import it at the entry point","cause":"reflect-metadata polyfill missing","error":"Error: Reflect is not defined"},{"fix":"Ensure 'angular2-annotations' is in plugins list and appears before transform-decorators-legacy","cause":"angular2-annotations plugin may be configured incorrectly or missing in .babelrc","error":"TypeError: Cannot read property 'annotations' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}