Reputation: 3545
Can anyone give me a working package.json to make angular2 AOT compile pass? My package is as below:
"dependencies": {
"@angular/common": "2.3.0",
"@angular/compiler": "2.3.0",
"@angular/compiler-cli": "2.3.0",
"@angular/core": "2.3.0",
"@angular/forms": "~2.1.1",
"@angular/http": "~2.1.1",
"@angular/platform-browser": "2.3.0",
"@angular/platform-browser-dynamic": "2.3.0",
"@angular/platform-server": "2.2.3",
"@angular/router": "~3.1.1",
"core-js": "^2.4.1",
"rxjs": "5.0.0-beta.12",
"socket.io": "^1.7.2",
"zone.js": "^0.6.25",
"typescript": "2.0.10",
},
And after I delete all node_modules and npm install all over again, I run:
node_modules/.bin/ngc -p tsconfig-aot.json
I get huge amount of errors.
Error at angular2/ng2_webpack_aot/node_modules/typescript/lib/lib.es2015.core.d.ts:17:14: Duplicate identifier 'PropertyKey'.
Error at angular2/ng2_webpack_aot/node_modules/@types/core-js/index.d.ts:21:14: Duplicate identifier 'PropertyKey'.
Error at angular2/ng2_webpack_aot/node_modules/@types/core-js/index.d.ts:85:5: All declarations of 'name' must have identical modifiers.
Error at angular2/ng2_webpack_aot/node_modules/@types/core-js/index.d.ts:145:5: Subsequent variable declarations must have the same type. Varia
.....
Can anyone share with me your configuration for package.json and can you compile AOT successfully?
My tsconfig-aot.json is as follows:
{
"compilerOptions": {
"target": "es5",
"module": "es2015",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"lib": ["es2015", "dom"],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
},
"files": [
"src/app/app.module.ts",
"src/main.ts"
],
"angularCompilerOptions": {
"genDir": "aot",
"skipMetadataEmit" : true
}
}
Upvotes: 0
Views: 163
Reputation: 14267
Its due to typings of core-js
and typescripts es2015
lib are overlapping, try to use lib es5
instead of es2015
Upvotes: 1
Reputation: 4787
Downgrade the version of typescript. Uninstall typescript version 2.0.10 and install version 2.0.3.
Upvotes: 0