Skip to content
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

1.6.1+ build optimizer breaking bootstrap carousel transition effects #9231

Closed
rajravat opened this issue Jan 16, 2018 · 10 comments · Fixed by #14187
Closed

1.6.1+ build optimizer breaking bootstrap carousel transition effects #9231

rajravat opened this issue Jan 16, 2018 · 10 comments · Fixed by #14187
Labels
needs: investigation Requires some digging to determine if action is needed

Comments

@rajravat
Copy link

rajravat commented Jan 16, 2018

Versions

   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/

Angular CLI: 1.6.4
Node: 8.1.4
OS: win32 x64
Angular: 5.2.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.6.4
@angular-devkit/build-optimizer: 0.0.38
@angular-devkit/core: 0.0.25
@angular-devkit/schematics: 0.0.48
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.4
@schematics/angular: 0.1.13
@schematics/schematics: 0.0.13
typescript: 2.5.3
webpack: 3.10.0

Repro steps

Observed behavior

carousel transitions are not behaving correctly.

Desired behavior

The transitions for the bootstrap carousel are very janky, i believe this is caused by the build optimizer and has been happening since cli 1.6.1+ (works fine with 1.6.0 and below), if you run ng server --prod --build-optimizer=false then the carousel transitions display correctly.

Is this a bug in the build optimizer? i'm currently working around this issue by downgrading to cli 1.6.0

Mention any other details that might be useful (optional)

The bootstrap version is 3.1.0

@clydin
Copy link
Member

clydin commented Jan 16, 2018

can you provide the ng version output for the downgraded working setup?

@rajravat
Copy link
Author

this is after downgrading to angular 1.6.0 where i dont need to disable the build optimizer

Node: 8.1.4
OS: win32 x64
Angular: 5.2.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.6.0
@angular-devkit/build-optimizer: 0.0.38
@angular-devkit/core: 0.0.25
@angular-devkit/schematics: 0.0.48
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.0
@schematics/angular: 0.1.13
@schematics/schematics: 0.0.13
typescript: 2.5.3
webpack: 3.10.0```

@clydin clydin self-assigned this Jan 17, 2018
@clydin clydin added the needs: investigation Requires some digging to determine if action is needed label Jan 17, 2018
@clydin
Copy link
Member

clydin commented Jan 17, 2018

It appears the same version of the build optimizer (0.0.38) is being used in both cases. Something else must be affecting the output between version 1.6.0 and 1.6.1. We'll need to perform some additional investigation to narrow down the cause. Can you provide the versions of uglify-es that are being used?

@rajravat
Copy link
Author

sorry are you able to tell me where i can find this information? i'm currently using the angular cli to create a new project and can't find any references to this in the package.json

@dinerotah
Copy link

@rajravat run on project root: npm ls uglify-es

@rajravat
Copy link
Author

rajravat commented Jan 18, 2018

@Taha-Di-Nero thanks!

uglify version when using cli 1.6.0:
-- @angular/cli@1.6.0 -- uglifyjs-webpack-plugin@1.1.6 -- uglify-es@3.3.7

uglify version when using cli 1.6.4:
-- @angular/cli@1.6.4 -- uglifyjs-webpack-plugin@1.1.6 -- uglify-es@3.3.7

looks like they are using the same version :(

@clydin
Copy link
Member

clydin commented Feb 6, 2018

This is actually due to the uglify-es setting pure_getters which is enabled when the build optimizer is enabled. The version of bootstrap being used (3.1.0) either contains code which uses property get functions with side effects or there's the potential that there could be a defect in uglify-es itself (same behavior was observed in 3.3.9, unfortunately). The pure_getters option is not something that can be removed as it is responsible for a large amount of the overall size reduction of the final output.

You could try a newer version of bootstrap (latest for 3.x is 3.3.7). However, for including bootstrap (and since jQuery is already include this way in the sample project), using the bootstrap CDN will allow the application to work as intended and increase the likelihood of a visual performance increase for end users. (Due to a greatly increased likelihood of the file being cached.)

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

@clydin clydin closed this as completed Feb 6, 2018
@Ranboz
Copy link

Ranboz commented Feb 9, 2018

Another FIX (load css & js from /assets/ folder)

  • Move bootstrap and JQuery files to /assets/..
  • Add references in index.html
  • Remove references from .angular-cli.json

new index.html

<head>
..
	<link rel="stylesheet" href="./assets/css/bootstrap.min.css">
..
</head>
<body>
..
	<script src="./assets/js/jquery.min.js"></script>
	<script src="./assets/js/bootstrap.min.js"></script>
..
</body>

Have a great day.

@itsSandeepNandey
Copy link

Thanks @Ranboz ,

This fixed for me :)

filipesilva added a commit to filipesilva/angular-cli that referenced this issue Apr 16, 2019
When we first started using Build Optimizer, we saw a lot of the savings were tied to using the Uglify/Terser `pure_getters` option.

This was intimately related with the structure and shape of the Angular codebase. The measurements we did at the time on angular.io showed a significant size reduction, from 1mb to about 600kb. Of these roughly 150kb were tied to using `pure_getters` if I remember correctly.

Meanwhile the Angular codebase has changed significantly and I don't really see these savings anymore, so I don't think it makes sense to keep it on given that it is known to cause problems with some libraries.

Related to angular#9231, angular#11439, angular#12096.
filipesilva added a commit to filipesilva/angular-cli that referenced this issue Apr 22, 2019
When we first started using Build Optimizer, we saw a lot of the savings were tied to using the Uglify/Terser `pure_getters` option.

This was intimately related with the structure and shape of the Angular codebase. The measurements we did at the time on angular.io showed a significant size reduction, from 1mb to about 600kb. Of these roughly 150kb were tied to using `pure_getters` if I remember correctly.

Meanwhile the Angular codebase has changed significantly and I don't really see these savings anymore, so I don't think it makes sense to keep it on given that it is known to cause problems with some libraries.

Closes angular#9231, angular#11439, angular#12096, angular#12128.
filipesilva added a commit to filipesilva/angular-cli that referenced this issue Apr 24, 2019
When we first started using Build Optimizer, we saw a lot of the savings were tied to using the Uglify/Terser `pure_getters` option.

This was intimately related with the structure and shape of the Angular codebase. The measurements we did at the time on angular.io showed a significant size reduction, from 1mb to about 600kb. Of these roughly 150kb were tied to using `pure_getters` if I remember correctly.

Meanwhile the Angular codebase has changed significantly and I don't really see these savings anymore, so I don't think it makes sense to keep it on given that it is known to cause problems with some libraries.

Closes angular#9231, angular#11439, angular#12096, angular#12128.
alexeagle pushed a commit that referenced this issue Apr 24, 2019
When we first started using Build Optimizer, we saw a lot of the savings were tied to using the Uglify/Terser `pure_getters` option.

This was intimately related with the structure and shape of the Angular codebase. The measurements we did at the time on angular.io showed a significant size reduction, from 1mb to about 600kb. Of these roughly 150kb were tied to using `pure_getters` if I remember correctly.

Meanwhile the Angular codebase has changed significantly and I don't really see these savings anymore, so I don't think it makes sense to keep it on given that it is known to cause problems with some libraries.

Closes #9231, #11439, #12096, #12128.
@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
@clydin clydin removed their assignment May 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: investigation Requires some digging to determine if action is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants