My name is pronounced like "shoe hey" ๐ ๐.
shuhei / babel-preset-angular2 Goto Github PK
View Code? Open in Web Editor NEWA Babel preset for angular2
A Babel preset for angular2
My name is pronounced like "shoe hey" ๐ ๐.
I was using your previous projects:
"babel-core": "^6.8.0",
"babel-plugin-angular2-annotations": "^5.1.0",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-flow-strip-types": "^6.8.0",
and upgraded to this project and get the following error now:
TypeError: Cannot read property 'query' of null(โฆ) "TypeError: Cannot read property 'query' of null
at eval (http://localhost:8080/jspm_packages/npm/@angular/[email protected]/src/provider_parser.js:360:37)
at Array.forEach (native)
at eval (http://localhost:8080/jspm_packages/npm/@angular/[email protected]/src/provider_parser.js:359:31)
at Array.forEach (native)
at _getContentQueries (http://localhost:8080/jspm_packages/npm/@angular/[email protected]/src/provider_parser.js:355:16)
at new ProviderElementContext (http://localhost:8080/jspm_packages/npm/@angular/[email protected]/src/provider_parser.js:55:32)
at TemplateParseVisitor.visitElement (http://localhost:8080/jspm_packages/npm/@angular/[email protected]/src/template_parser.js:282:31)
at HtmlElementAst.visit (http://localhost:8080/jspm_packages/npm/@angular/[email protected]/src/html_ast.js:59:83)
at eval (http://localhost:8080/jspm_packages/npm/@angular/[email protected]/src/html_ast.js:76:29)
at Array.forEach (native)"
Is this supposed to be compatible with the above?
Hi,
I would like to create an exportable angular module. So I created this module :
// index.js
import { NgModule, Component } from '@angular/core';
@Component({
selector: 'module1-component',
template: '<h1>Module 1</h1>'
})
class Module1Component {
constructor() {}
}
@NgModule({
imports: [],
declarations: [Module1Component],
providers: [],
exports: [Module1Component]
})
export class Module1 {}
with this package.json
{
"name": "module1",
"main": "index.js",
"babel": {
"presets": [
"es2015",
"angular2"
]
},
"browserify": {
"transform": [
["babelify"]
]
},
"dependencies": {
"@angular/common": "^4.4.4",
"@angular/compiler": "^4.4.4",
"@angular/core": "^4.4.4"
},
"devDependencies": {
"babel-preset-angular2": "0.0.2",
"babel-preset-es2015": "^6.24.1",
"babelify": "^7.3.0",
"browserify": "^14.4.0"
}
}
Next I created another module which will import my first module and I linked module1 with module2 by npm link module1
import 'babel-polyfill';
import 'zone.js/dist/zone';
import { NgModule, Component } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { Module1 } from 'module1';
@Component({
selector: 'module2-component',
template: `
<h1>Module 2</h1>
<module1-component></module1-component>
`
})
class Module2Component {
constructor () {}
}
@NgModule({
imports: [BrowserModule, Module1],
declarations: [Module2Component],
providers: [],
bootstrap: [Module2Component],
})
class Module2 {}
platformBrowserDynamic().bootstrapModule(Module2);
with this package.json
{
"name": "module2",
"version": "0.1.0",
"main": "index.js",
"babel": {
"presets": [
"es2015",
"angular2"
]
},
"dependencies": {
"@angular/common": "^4.4.4",
"@angular/compiler": "^4.4.4",
"@angular/core": "^4.4.4",
"@angular/platform-browser": "^4.4.4",
"@angular/platform-browser-dynamic": "^4.4.4",
"babel-polyfill": "^6.26.0",
"rxjs": "^5.4.3",
"zone.js": "^0.8.18"
},
"devDependencies": {
"babel": "^6.23.0",
"babel-preset-angular2": "0.0.2",
"babel-preset-es2015": "^6.24.1",
"babelify": "^7.3.0",
"browserify": "^14.4.0"
}
}
And when I built module2 with browserify src/app.js -o dist/app.js -t [ babelify ]
and I looked the result I had this error :
Unexpected value 'Module1' imported by the module 'Module2'. Please add a @NgModule annotation.
I think the error is due to the transpilation when importing Module1 (it has no more annotation).
Have you any ideas ? Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.