Registry / web-framework / babel-preset-angular2

babel-preset-angular2

JSON →
library0.0.2jsnpmunverified

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.

npm install babel-preset-angular2
INSTALL
IMPORT
SIG · BABEL-PRESET-ANGUL
B
babel-preset-angular2
web-frameworkjavascriptv0.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

default (preset)
{ "presets": ["es2015", "angular2"] }
{ "presets": ["angular2"] }
The preset does not include ES2015 features; you must also add the es2015 preset in .babelrc.

Shows installation, .babelrc configuration, and a basic Angular 2 component using decorators.

// Install the preset and its peer dependency npm install --save-dev babel-preset-angular2 babel-preset-es2015 // .babelrc { "presets": ["es2015", "angular2"] } // Example Angular 2 component (with decorators) import { Component } from '@angular/core'; @Component({ selector: 'hello-world', template: '<h1>Hello {{ name }}!</h1>' }) export class HelloWorldComponent { name: string = 'Angular 2'; }
Debug
Known issues
deprecatedThis preset is unmaintained and only supports Angular 2.0 (not later versions).
fix
Use the Angular CLI with TypeScript and the Angular compiler instead of Babel for Angular projects.
affects: >=0.0.0
breakingMissing es2015 preset will cause syntax errors in Angular 2 templates or ES2015 code.
fix
Always include the es2015 preset in your .babelrc.
affects: >=0.0.0
gotchaThe decorator transform is based on legacy decorators, which may not work with newer TypeScript or Angular versions.
fix
Use TypeScript's own decorator support instead of Babel for Angular projects.
affects: 0.0.0
Errors
Common errors & fixes
SyntaxError: Unexpected token @
Missing the babel-plugin-transform-decorators-legacy plugin or the angular2 preset.
fix
Ensure babel-preset-angular2 is installed and listed in your .babelrc presets.
Upgrade
Version history
0.0.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
10
OpenAI (training)
1
Resources
babel-preset-angular2 — npm install babel-preset-angular2 · libregistry