Unexpected Token Export - Angular 2

I am trying to import import {UpgradeComponent} from '@ angular / upgrade / static'; to use angular1 directive in angular2 using ngupgrade, but I get this error.

the code:

import { Directive, ElementRef, Injector } from '@angular/core';
import { UpgradeComponent } from '@angular/upgrade/static';
@Directive({
  selector: 'help'
})
export class HelpComponentA1Directive extends UpgradeComponent {
  constructor(elementRef: ElementRef, injector: Injector) {
      super('help', elementRef, injector);
  }
}
+4
source share
1 answer

exportis not a javascript keyword, since your browser downloads the file .tswhen it should download the compiled file .js.

, , . -, , , @angular/upgrade/static, node_modules/@angular/upgrade/static.ts.

  • node_modules/@angular/upgrade/static.js,
  • node_modules/@angular/upgrade/bundles/static.umd.js

, ( ), , - import @angular/upgrade/static.

0

Source: https://habr.com/ru/post/1662694/


All Articles