Unexpected token export

随声附和 提交于 2019-12-04 12:18:02

As we can see from the error stack trace, it fails parsing @angular/core/index.js. While you are tranpiling your own source files, angular is deployed as ES2015 modules with ES5 syntax. You have to use a pure ES5 version, which I suggest the deployed UMD files.

Update your systemjs.config.js like this:

// map tells the System loader where to look for things
map: {
  // our app is within the app folder
  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',

Or rather use a existing working setup (like angular quickstart), it is a good start. Or yet use angular-cli, this is better for the long term.

Source: https://cdn.rawgit.com/angular/angular.io/b3c65a9/public/docs/_examples/_boilerplate/systemjs.config.web.js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!