Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

AOT issue after upgrade to 2.0.2 #1112

Closed
kodeine opened this issue Jul 14, 2017 · 31 comments
Closed

AOT issue after upgrade to 2.0.2 #1112

kodeine opened this issue Jul 14, 2017 · 31 comments

Comments

@kodeine
Copy link

kodeine commented Jul 14, 2017

Short description of the problem:

just upgraded ionic-app-scripts and ionic-angular, added vendor.js in index as well but now getting error on AOT which wasnt there on < 2.0.2 of app-scripts. non aot builds with ionic serve is fine.

image

Steps to reproduce:

  1. ionic cordova build android --prod --release

Which @ionic/app-scripts version are you using?
global packages:

@ionic/cli-utils : 1.5.0
Cordova CLI      : 7.0.1 
Ionic CLI        : 3.5.0

local packages:

@ionic/app-scripts              : 2.0.2
@ionic/cli-plugin-cordova       : 1.4.1
@ionic/cli-plugin-ionic-angular : 1.3.2
Cordova Platforms               : android 6.2.3
Ionic Framework                 : ionic-angular 3.5.2

System:

Node       : v6.6.0
OS         : Linux 4.2
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed
npm        : 5.0.4 
@danbucholtz
Copy link
Contributor

@kodeine,

How can I recreate this? What angular version do you have?

Thanks,
Dan

@kodeine
Copy link
Author

kodeine commented Jul 14, 2017

@danbucholtz its 4.1.3

 "dependencies": {
        "@angular/animations": "4.1.3",
        "@angular/common": "4.1.3",
        "@angular/compiler": "4.1.3",
        "@angular/compiler-cli": "4.1.3",
        "@angular/core": "4.1.3",
        "@angular/forms": "4.1.3",
        "@angular/http": "4.1.3",

@danbucholtz
Copy link
Contributor

Can you try with 4.0.1 of app-scripts? I am confused, nothing here has changed in a good long while. Can you try with 1.3.12?
Thanks,
Dan

@kodeine
Copy link
Author

kodeine commented Jul 14, 2017

4.0.1 of app-scripts? or you mean angular?
app-scripts 1.3.12 worked fine earlier, going to try again to be 100%

@kodeine
Copy link
Author

kodeine commented Jul 14, 2017

@danbucholtz
okay its confirmed, 2.0.2 breaks aot.

ionic-angular 3.5.2 works fine with app-scripts 1.3.12

@marcorosi
Copy link
Contributor

hi, if it can be useful i just upgraded but no issue for me

global packages:

@ionic/cli-utils : 1.5.0
Cordova CLI      : 7.0.1 
Ionic CLI        : 3.5.0

local packages:

@ionic/app-scripts              : 2.0.2
@ionic/cli-plugin-cordova       : 1.4.1
@ionic/cli-plugin-ionic-angular : 1.3.2
Cordova Platforms               : android 6.2.3 ios 4.4.0
Ionic Framework                 : ionic-angular 3.5.2

System:

Node       : v6.10.0
OS         : Linux 4.4
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed
npm        : 3.10.10 

@danbucholtz
Copy link
Contributor

@kodeine,

I think this is an npm issue. They have had a ton of issues with 5.0.x and 5.2.x. Can you try installing npm install -g [email protected]`? That seems to be by far the most stable. I am pretty sure this is a lock file issue.

Thanks,
Dan

@kodeine
Copy link
Author

kodeine commented Jul 16, 2017

@danbucholtz
i've installed npm 5.1.0 and now i am getting this error on ionic serve.

image

UPDATE:
Ionic serve works with npm 5.1.0

global packages:

    @ionic/cli-utils : 1.5.0
    Cordova CLI      : 7.0.1 
    Ionic CLI        : 3.5.0

local packages:

    @ionic/app-scripts              : 2.0.2
    @ionic/cli-plugin-cordova       : 1.4.1
    @ionic/cli-plugin-ionic-angular : 1.3.2
    Cordova Platforms               : android 6.2.3
    Ionic Framework                 : ionic-angular 3.5.3

System:

    Node       : v6.6.0
    OS         : Linux 4.2
    Xcode      : not installed
    ios-deploy : not installed
    ios-sim    : not installed
    npm        : 5.1.0 

@kodeine
Copy link
Author

kodeine commented Jul 18, 2017

@danbucholtz so it works fine on ionic serve but after build release i see the same error

image

it works fine with app-scripts 1.3.12.

www folder locally has 0.js etc but when it was deployed it doesnt have those files as in the image.. is this how its suppose to be?

image

image

@vkniazeu
Copy link

@kodeine , your webpackJsonp is not defined is due to the missing vendor.js in your index.html.
See https://github.com/ionic-team/ionic-app-scripts/blob/master/CHANGELOG.md#200-2017-07-07

@kodeine
Copy link
Author

kodeine commented Jul 18, 2017

@vkniazeu
thats how my index.html looks.

<body>

<!-- Ionic's root component and where the app will load -->
<ion-app></ion-app>

<!-- The polyfills js is generated during the build process -->
<script src="build/polyfills.js"></script>

<!-- all code from node_modules directory is here -->
<script src="build/vendor.js"></script>

<!-- The bundle js is generated during the build process -->
<script src="build/main.js"></script>

</body>
</html>

@vkniazeu
Copy link

@kodeine hmm... i'd get that error forgetting to add vendor.js.
I'm, however, on npm 5.3.0.
Try upgrading: npm i -g npm - that helped me before with older ionic-app-scripts issues.

@kodeine
Copy link
Author

kodeine commented Jul 18, 2017

@vkniazeu just updated to 5.3.0 and same damn issue. i got no idea whats causing this even though everything works fine with app-scripts 1.3.12

@vkniazeu
Copy link

@kodeine, are you using typescript 2.4.1 ? Perhaps, downgrading to 2.3.4 can help?
#1114, #1120 are related to 2.0.2 upgrade, but not sure if they affect this problem.
I've gone down to 2.0.0 for now. Can't give this much more time ATM.

@kodeine
Copy link
Author

kodeine commented Jul 18, 2017

@vkniazeu i've tried with TS 2.3.4 also with app-scripts 2.0.0 same error.
but now i've downgraded app scripts to 1.3.12 and everything works as it should.

@danbucholtz
Copy link
Contributor

This seems like a lock file issue to me. How can I recreate? If this was affecting a lot of apps, believe me, we would have heard about it 😸 .

Thanks,
Dan

@kodeine
Copy link
Author

kodeine commented Jul 19, 2017

Give me your email ill allow access to project so you can check it out.

@danbucholtz
Copy link
Contributor

Can you recreate in a simple project and upload to github?

Thanks,
Dan

@kodeine
Copy link
Author

kodeine commented Jul 19, 2017 via email

@danbucholtz
Copy link
Contributor

Okay, cool, you should be able to add my username danbucholtz.

Thanks,
Dan

@kodeine
Copy link
Author

kodeine commented Jul 19, 2017

Okay give me 1 hr ill go home and add it

@kodeine
Copy link
Author

kodeine commented Jul 19, 2017

@danbucholtz i've given you permissions on the project. Thanks for everything!

@trebor678
Copy link

Any news on this? I'm having the same problem

@danbucholtz
Copy link
Contributor

I haven't had a chance to look yet. @trebor678, are you doing anything interesting with webpack or anything like that?

Thanks,
Dan

@kodeine
Copy link
Author

kodeine commented Jul 25, 2017

@danbucholtz were you able to take a look at the repo i authorized you at?

@danbucholtz
Copy link
Contributor

Sorry, I haven't had a chance yet. It is surprising because nothing with AOT changed in quite a while.

Thanks,
Dan

@kodeine
Copy link
Author

kodeine commented Jul 28, 2017

@danbucholtz i just updated to latest app-scripts and same issue. i'm already pulling off my hair at this point.

@kodeine
Copy link
Author

kodeine commented Jul 29, 2017

@danbucholtz
so i ran npm run build --prod and didnt do the minification etc to debug further. this is what i get after enabling the sourcemaps. ionic serve works just fine.

image

image

I re-checked the providers, there doesnt seem to be any problem. I'm super confused.

@kodeine
Copy link
Author

kodeine commented Jul 31, 2017

@kodeine
Copy link
Author

kodeine commented Aug 1, 2017

Problem is fixed! =)

It was a circular dependency issue. After installing https://github.com/aackerman/circular-dependency-plugin i was able to figure out what providers were messing up with circular dependencies.

@kodeine kodeine closed this as completed Aug 1, 2017
@darmie
Copy link

darmie commented Jan 9, 2018

@kodeine I am also having this problem, can you explain how you solved it using Circular Dependency Plugin?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants