将ASP.Net Core Angular 2应用程序从Angular 2升级到Angular4

时间:2017-04-13 17:12:09

标签: angular asp.net-core

我使用Microsoft.AspNetCore.SpaTemplates(.Net Core 1.1和Angular 2)中的模板创建了一个Angular SPA应用程序。我正在尝试按照here的说明将此项目升级到Angular4。

升级后,如果我尝试运行应用程序,我收到此错误

Call to node module failed with error

我改变了这个:

import { UniversalModule } from 'angular2-universal

到此:

import { BrowserModule } from '@angular/platform-browser';

由于UniversalModule现在是平台浏览器的一部分,dotnet spa模板生成的文件是否需要进行任何更改?

由于我从项目中删除了angular2-universal,我在某些地方收到错误。例如,在boot-client.ts中:
import { platformUniversalDynamic } from 'angular2-universal';

现在platformUniversalDynamic位于何处?此外,我应该删除所有对' angular2-universal-polyfills / browser'和类似的参考?

以下是来自packages.json

的依赖项部分
"dependencies": {
   "@angular/animations": "^4.0.2",
   "@angular/common": "^4.0.2",
   "@angular/compiler": "^4.0.2",
   "@angular/compiler-cli": "^4.0.2",
   "@angular/core": "^4.0.2",
   "@angular/forms": "^4.0.2",
   "@angular/http": "^4.0.2",
   "@angular/platform-browser": "^4.0.2",
   "@angular/platform-browser-dynamic": "^4.0.2",
   "@angular/platform-server": "^4.0.2",
   "@angular/router": "^4.0.2",
   "@types/node": "^6.0.42",
   "aspnet-prerendering": "^2.0.0",
   "aspnet-webpack": "^1.0.17",
   "awesome-typescript-loader": "^3.0.0",
   "bootstrap": "^3.3.7",
   "css": "^2.2.1",
   "css-loader": "^0.25.0",
   "es6-shim": "^0.35.1",
   "event-source-polyfill": "^0.0.7",
   "expose-loader": "^0.7.1",
   "extract-text-webpack-plugin": "^2.0.0-rc",
   "file-loader": "^0.9.0",
   "html-loader": "^0.4.4",
   "isomorphic-fetch": "^2.2.1",
   "jquery": "^2.2.1",
   "json-loader": "^0.5.4",
   "preboot": "^4.5.2",
   "raw-loader": "^0.5.1",
   "rxjs": "^5.3.0",
   "style-loader": "^0.13.1",
   "to-string-loader": "^1.1.5",
   "typescript": "^2.2.2",
   "url-loader": "^0.5.7",
   "webpack": "^2.2.0",
   "webpack-hot-middleware": "^2.12.2",
   "webpack-merge": "^0.14.1",
   "zone.js": "^0.8.4"
 }

0 个答案:

没有答案