{"id":26786,"library":"babel-preset-angular2","title":"babel-preset-angular2","description":"A Babel preset (v0.0.2, last updated in 2016) for compiling Angular 2 applications, wrapping plugins for Angular 2 annotations, decorators, class properties, and Flow type stripping. This package is outdated and unmaintained; Angular 2+ now uses TypeScript and the official Angular CLI, making this preset obsolete. It depends on legacy Babel 6 plugins and is not compatible with modern Angular versions or Babel 7+. Use for legacy projects only; new projects should use the Angular CLI with TypeScript.","status":"deprecated","version":"0.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/shuhei/babel-preset-angular2","tags":["javascript","babel","babel-plugin","angular","angular2","ng2","decorator"],"install":[{"cmd":"npm install babel-preset-angular2","lang":"bash","label":"npm"},{"cmd":"yarn add babel-preset-angular2","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-preset-angular2","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The preset does not include ES2015 features; you must also add the es2015 preset in .babelrc.","wrong":"{\n  \"presets\": [\"angular2\"]\n}","symbol":"default (preset)","correct":"{\n  \"presets\": [\"es2015\", \"angular2\"]\n}"}],"quickstart":{"code":"// Install the preset and its peer dependency\nnpm install --save-dev babel-preset-angular2 babel-preset-es2015\n\n// .babelrc\n{\n  \"presets\": [\"es2015\", \"angular2\"]\n}\n\n// Example Angular 2 component (with decorators)\nimport { Component } from '@angular/core';\n\n@Component({\n  selector: 'hello-world',\n  template: '<h1>Hello {{ name }}!</h1>'\n})\nexport class HelloWorldComponent {\n  name: string = 'Angular 2';\n}","lang":"javascript","description":"Shows installation, .babelrc configuration, and a basic Angular 2 component using decorators."},"warnings":[{"fix":"Use the Angular CLI with TypeScript and the Angular compiler instead of Babel for Angular projects.","message":"This preset is unmaintained and only supports Angular 2.0 (not later versions).","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Always include the es2015 preset in your .babelrc.","message":"Missing es2015 preset will cause syntax errors in Angular 2 templates or ES2015 code.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Use TypeScript's own decorator support instead of Babel for Angular projects.","message":"The decorator transform is based on legacy decorators, which may not work with newer TypeScript or Angular versions.","severity":"gotcha","affected_versions":"0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Ensure babel-preset-angular2 is installed and listed in your .babelrc presets.","cause":"Missing the babel-plugin-transform-decorators-legacy plugin or the angular2 preset.","error":"SyntaxError: Unexpected token @"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}