简体   繁体   中英

Cannot import UpgradeModule from @angular\upgrade\static Angular V2.2.1

I'm currently upgrading my AngularJS (ng1) app to Angular 2 (ng2).

I'm using Angular version 2.2.1.

When I'm importing UpgradeModule from @angular\\upgrade\\static I get the following exception: Uncaught SyntaxError: Unexpected reserved word Uncaught ReferenceError: webpackJsnop is not defined

I'm using WebPack V1.13.1.

When I'm using the upgrade_adapter way I need to add the @Inject annotation.

Thanks for the Help.

This might be an Angular bug. You can have a temporal fix just to test what you are doing by deleting this file:

node_modules/@angular/upgrade/static.js

What is going on is that webpack is prioritizing the file below and that is why it is throwing that exception:

node_modules/@angular/upgrade/static/package.json

I wanted to leave this under comments, but I did not have the enough reputation to leave it there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM