[当前,我正在将我的Angular 4与system.js一起使用。现在我将其更新为Angular 8。
为此,我遵循以下2个链接:
upgrade angular 4 project to angular 6
https://www.talkingdotnet.com/upgrade-angular-4-app-angular-5-visual-studio-2017/
我做了以下更改:
当我在完成所有更改后运行应用程序并且出现以下错误时:
未捕获的SyntaxError:意外令牌'
我是否需要从system.js进行任何映射请在下面的system.js中找到:
paths: {
'npm:': './node_modules/'
},
map: {
'app': './app',
// angular bundles
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
'@angular/animations': 'npm:@angular/animations/bundles/animations.umd.js',
'@angular/animations/browser': 'npm:@angular/animations/bundles/animations-browser.umd.js',
'@angular/platform-browser/animations': 'npm:@angular/platform-browser/bundles/platform-browser-animations.umd.js',
// other libraries
'rxjs': 'npm:rxjs',
'lodash': 'npm:lodash',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
'@ng-bootstrap/ng-bootstrap': 'npm:@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js',
'@bento.ui/bento-ng': 'npm:@bento.ui/bento-ng/bundles/bento.ui.js',
'ngx-restangular': 'npm:ngx-restangular/dist/esm/src',
'angular-2-local-storage': 'npm:angular-2-local-storage/dist',
'@ngx-translate/core': 'npm:@ngx-translate/core/bundles/core.umd.js',
'@ngx-translate/http-loader': 'npm:@ngx-translate/http-loader/bundles/http-loader.umd.js',
'angular2-tinymce': 'npm:angular2-tinymce/dist',
'tinymce': './Scripts/vendors/tinymce',
'ng2-dnd': 'npm:ng2-dnd/bundles/index.umd.js',
},
meta: {
'./Scripts/vendors/tinymce/plugins/advlist/plugin.js': { format: 'global' },
'./Scripts/vendors/tinymce/plugins/autoresize/plugin.js': { format: 'global' },
'./Scripts/vendors/tinymce/plugins/code/plugin.js': { format: 'global' },
'./Scripts/vendors/tinymce/plugins/link/plugin.js': { format: 'global' },
'./Scripts/vendors/tinymce/plugins/lists/plugin.js': { format: 'global' },
'./Scripts/vendors/tinymce/plugins/paste/plugin.js': { format: 'global' },
'./Scripts/vendors/tinymce/plugins/table/plugin.js': { format: 'global' },
'./Scripts/vendors/tinymce/plugins/image/plugin.js': { format: 'global' },
'./Scripts/vendors/tinymce/plugins/textcolor/plugin.js': { format: 'global' },
'./Scripts/vendors/tinymce/plugins/imagetools/plugin.js': { format: 'global' },
'./Scripts/vendors/tinymce/plugins/contextmenu/plugin.js': { format: 'global' },
'./Scripts/vendors/tinymce/themes/modern/theme.js': { format: 'global' },
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
app: {
main: './main.js',
defaultExtension: 'js'
//meta: {
// './*.js': {
// loader: 'systemjs-angular-loader.js'
// }
//}
},
'ngx-restangular': {
main: './index',
defaultExtension: 'js'
},
rxjs: {
main: "./Rx.js",
defaultExtension: 'js'
},
lodash: {
main: './index.js',
defaultExtension: 'js'
},
'angular-2-local-storage': {
main: './index',
defaultExtension: 'js'
},
moment: {
main: './moment.js',
defaultExtension: 'js'
},
'@ngx-translate/core': {
defaultExtension: 'js'
},
'angular2-tinymce': {
main: 'index.js',
defaultExtension: 'js'
},
'tinymce': {
defaultExtension: 'js'
}
},
warnings: true
});
和下面是package.json:
"dependencies": {
"@angular/animations": "8.2.14",
"@angular/common": "8.2.14",
"@angular/compiler": "8.2.14",
"@angular/compiler-cli": "8.2.14",
"@angular/core": "8.2.14",
"@angular/forms": "8.2.14",
"@angular/http": "7.2.15",
"@angular/platform-browser": "^8.2.14",
"@angular/platform-browser-dynamic": "8.2.14",
"@angular/platform-server": "8.2.14",
"@angular/router": "8.2.14",
"@angular/upgrade": "8.2.14",
"@ng-bootstrap/ng-bootstrap": "5.1.4",
"@ngx-translate/core": "11.0.1",
"@ngx-translate/http-loader": "4.0.0",
"@types/lodash": "4.14.149",
"angular-2-local-storage": "3.0.2",
"angular-in-memory-web-api": "0.9.0",
"angular2-tinymce": "3.3.0",
"bootstrap": "4.3.1",
"core-js": "3.4.2",
"font-awesome": "4.7.0",
"ie-shim": "0.1.0",
"lodash": "4.17.15",
"markdown-it": "10.0.0",
"ng2-dnd": "5.0.2",
"ngx-restangular": "5.0.0",
"rxjs": "^6.5.3",
"systemjs": "6.1.5",
"tinymce": "5.1.2",
"topojson": "3.0.2",
"typescript": "2.5.3",
"zone.js": "0.10.2"
},
"devDependencies": {
"@types/node": "12.12.14",
"fs": "0.0.2",
"gulp": "4.0.2",
"gulp-cache-bust": "1.4.1",
"gulp-clean-css": "4.2.0",
"gulp-concat": "2.6.1",
"gulp-filter": "6.0.0",
"gulp-foreach": "0.1.0",
"gulp-inline-ng2-styles": "0.0.1",
"gulp-inline-ng2-template": "5.0.1",
"gulp-rev": "9.0.0",
"gulp-sourcemaps": "2.6.5",
"gulp-typescript": "5.0.1",
"gulp-uglify": "3.0.2",
"rimraf": "3.0.0",
"run-sequence": "2.2.1",
"systemjs-builder": "0.16.15",
"typescript": "3.7.2",
"vinyl-buffer": "1.0.1",
"vinyl-source-stream": "2.0.0"
},
"repository": {}
}
预先感谢。
这里是角度网站的Angular Update Guide。
[我注意到您在开发依赖项中使用了两个版本的打字稿,分别是“ 2.5.3”和“ 3.7.2”,我只使用推荐的版本,即angular〜“ 3.1”。
我建议您一次更新1个版本,我知道它的过程如此漫长,但是比起从4升级到8,您更容易解决问题。