Sean Sobey
Sean Sobey

Reputation: 972

JSPM bundle Angular 2 'sourceType: module' error

I am trying to create a JSPM bundle using Angular 2 version 2.2.1.

Using this command:

jspm bundle @angular/common + @angular/compiler + @angular/core + @angular/forms + @angular/http + @angular/platform-browser + @angular/platform-browser-dynamic + @angular/router + @angular/upgrade

Results in this error:

err  SyntaxError: jspm_packages/npm/@angular/[email protected]/src/facade/lang.js: 'import' and 'export' may appear only with 'sourceType: module' (23:0)

Upvotes: 0

Views: 114

Answers (1)

Sean Sobey
Sean Sobey

Reputation: 972

Turns out Angular2 supports UMD/AMD modules, so JSPM can be set to work like so:

"overrides": {
  "npm:@angular/[email protected]": {
    "format": "amd"
  },
  "npm:@angular/[email protected]": {
    "format": "amd"
  },
  "npm:@angular/[email protected]": {
    "format": "amd"
  },
  "npm:@angular/[email protected]": {
    "format": "amd"
  },
  "npm:@angular/[email protected]": {
    "format": "amd"
  },
  "npm:@angular/[email protected]": {
    "format": "amd"
  },
  "npm:@angular/[email protected]": {
    "format": "amd"
  },
  "npm:@angular/[email protected]": {
    "format": "amd"
  },

Upvotes: 1

Related Questions