angular - module resolution with angular2 / ASP.NET5 (cannot find angular2/core) -


i have started new asp.net5/mvc6 project.

attempt 1 problem when set moduleresolution classic in tsconfig.json receive error follows:

cannot find module 'angular2/core'

attempt 2 if change tsconfig.json use node resolution, exclude node_modules in tsconfig.js not work, this bug?, closed, though still seems problem, , multiple errors encountered when studio 2015 trolls through node_modules folder including every .d.ts in entire tree. there hundreds of errors, in rxjs.

attempt 3 if remove tsconfig.json completely, can application executing, , files compiled, alas, error in browser.

error: (systemjs) require not defined

i cannot think angular2 / typescript support in visual studio is complete mess, , should go angular 1 , mvc5. record, using typescript 2.0.6, , visual studio date.

is there combination of package.json , tsconfig.json works out of box visual studio 2015 angular2.

package.json has following dependencies.

{   "version": "1.0.0",   "name": "asp.net",   "private": true,   "devdependencies": {     "angular2": "^2.0.0-beta.17"   },   "dependencies": {     "@types/angular2": "0.0.2",     "angular2": "^2.0.0-beta.17",     "es6-shim": "^0.35.1",     "gulp": "^3.9.1",     "gulp-jasmine": "^2.4.2",     "gulp-print": "^2.0.1",     "gulp-sass": "^2.3.2",     "gulp-typings": "^2.0.4",     "gulp-watch": "^4.3.10",     "karma": "^1.3.0",     "reflect-metadata": "^0.1.8",     "rxjs": "^5.0.0-rc.2",     "zone.js": "^0.6.26"   } } 

tsconfig.json follows

{   "compileroptions": {     "experimentaldecorators": true,     "moduleresolution": "classic"   },   "exclude": ["node_modules"] } 

boot.ts follows

/// <reference path="../node_modules/angular2/core.d.ts"/> //  above correct path, doesn't seem matter. import {bootstrap} "angular2/platform/browser"; //                       ~~~~~~~~~~~~~~~~~~~~~~~~~ (error here) import {http_providers} "angular2/http"; import {appcomponent} "./app.component";  bootstrap(appcomponent, [http_providers]); console.log("starting angular..."); 

app.component.js

/// <reference path="../node_modules/angular2/core.d.ts"/>  import { component, oninit } "angular2/core"; //                                 ~~~~~~~~~~~~~ (error here)  @component({     selector: "app",     templateurl: "static.html" }) export class appcomponent implements oninit {     message: string;      constructor() {         console.log("starting app component");     }      ngoninit() {                     .message =             "the 'static.html' used angular2 'templateurl'. there 'message' property bound <blockqoute> element.";     } } 

nb: make es6-shim.d.ts installed in wwwroot directory. many of node_modules files traversed typescript cannot compiled without es6-shim.d.ts

i have sample on integrating angular2(2.1.0) , asp.net core, think ng2's packages dependencies work on asp.net5.

package.json

systemjs.config.js

hope helps!


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -