Skip to content

Using build optimizer in 6.0.8 makes my production build freeze in Windows Edge and iOS Safari, works on Chrome and FF #11459

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lehtiniemi opened this issue Jul 5, 2018 · 5 comments

Comments

@lehtiniemi
Copy link

lehtiniemi commented Jul 5, 2018

Bug Report or Feature Request (mark with an x)

- [ X ] bug report -> please search issues before submitting
- [ ] feature request

Area

- [ ] devkit
- [ ] schematics

Versions

Node-version: v9.4.0
npm-version: 6.1.0

ng --v:

Angular CLI: 6.0.8
Node: 9.4.0
OS: win32 x64
Angular: 6.0.7
... animations, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic
... platform-server, router

Package Version

@angular-devkit/architect 0.6.8
@angular-devkit/build-angular 0.6.8
@angular-devkit/build-optimizer 0.4.9
@angular-devkit/core 0.6.8
@angular-devkit/schematics 0.6.8
@angular/cdk 6.3.2
@angular/cli 6.0.8
@angular/material 6.3.2
@ngtools/webpack 6.0.8
@schematics/angular 0.6.8
@schematics/update 0.6.8
rxjs 6.2.1
typescript 2.7.2
webpack 4.8.3

The log given by the failure

There's no error in the browser console.

Mention any other details that might be useful

I updated my app to v6 from Angular CLI 1.7.4. It compiles, but the production version freezes the browser at certain points when using the app, always the same place. There's no log, both Edge on Windows 10 and Safari on iOS freeze when using the app. This didn't happen on 1.7.4.

Any tips on how to debug this? I can't replicate the problem when using ng serve, however, it does happen when using ng serve --prod

@lehtiniemi
Copy link
Author

I don't know if it's related to this, but initially after the update I was having the error "No NgModule metadata found for 'AppModule'' so I'm using the workaround suggested in #8798 - adding

"files": [
"src/app/app.module.ts"
]

to my tsconfig.json. It fixes the error, but can it cause some reliability issues like this? I'm getting the frozen browser in many situations in the app just by clicking around so it's really hard to know what causes it - especially when it never happened before in earlier versions. It happens when components get unloaded and added to dom based on changes in the model (like the three layout buttons in the example site).

@lehtiniemi lehtiniemi changed the title Production version freezes in certain conditions, dev version doesn't - after updating to v6 Using build optimizer in 6.0.8 makes production build freeze Windows Edge and iOS Safari Jul 5, 2018
@lehtiniemi
Copy link
Author

lehtiniemi commented Jul 5, 2018

I found the reason for the freeze - when I disable build optimizer, my app works as expected. The size goes up 300kb but it's better than freezing app.

What such things does build optimizer do that it can cause the script to freeze? Is there any way to find the point where the app gets stuck?

@lehtiniemi lehtiniemi changed the title Using build optimizer in 6.0.8 makes production build freeze Windows Edge and iOS Safari Using build optimizer in 6.0.8 makes my production build freeze in Windows Edge and iOS Safari, works on Chrome and FF Jul 5, 2018
@clydin
Copy link
Member

clydin commented Jul 6, 2018

It appears the project is using an outdated version of the build optimizer (@angular-devkit/build-optimizer 0.4.9). If it is present within the project's package.json, you can try removing it via npm uninstall --save @angular-devkit/build-optimizer.

@lehtiniemi
Copy link
Author

lehtiniemi commented Jul 6, 2018

You saved my day. I did:

npm uninstall @angular-devkit/build-optimizer --save-dev //since it was in the devDependencies, I don't know if that is relevant, but it worked
npm install @angular-devkit/build-optimizer --save-dev // installed the latest version

Now it works, no more freezing. Thank you so very much! :)

As a side-note, ng update told me I was up to date so it didn't see that this dependency was outdated. It would be helpful for others in my situation if ng update noticed this and updated it automatically.

@clydin clydin closed this as completed Jul 19, 2018
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
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

2 participants