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

813 Views Asked by At

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.

1

There are 1 best solutions below

0
xiltepin On BEST ANSWER

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.