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

styles that are not injected do count for initial bundle size. #17672

Closed
1 of 15 tasks
roymilder opened this issue May 8, 2020 · 2 comments · Fixed by #19876
Closed
1 of 15 tasks

styles that are not injected do count for initial bundle size. #17672

roymilder opened this issue May 8, 2020 · 2 comments · Fixed by #19876

Comments

@roymilder
Copy link

roymilder commented May 8, 2020

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • xi18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Unknown

Description

We generate different themes for our production build.
All are based on the same base styles with a different variables.scss.
We produce new files on each production build (which is handled by our ci/cd so build time is not that important).

the different styles are defined in the "styles" section of angular.json:

            "styles": [
              {
                "input": "./src/projects/contrast/styles.scss",
                "bundleName": "contrast",
                "inject": false
              },
              {
                "input": "./src/projects/projecta/styles.scss",
                "bundleName": "923a0aa8-73de-46f4-966a-26f1c39ce8e6",
                "inject": false
              },
              {
                "input": "./src/projects/projectb/styles.scss",
                "bundleName": "d945e725-7e1e-4fa5-b372-3d577b3d94cb",
                "inject": false
              },
and so on
              "src/styles.scss"
            ],
            "scripts": [
            ],

As you can see, the files are not injected.
In the production index.html I have verified that the files are not injected.

However, recently the budget exceeded for initial error caused our build to fail:

ERROR in budgets: Exceeded maximum budget for initial. Budget 5 MB was not met by 270 kB with a total of 5.26 MB.

When we removed the different themes, the error dissapeared.

When looking at the build log it looks like the size of all the additional themes are included sum of the initial bundle size and thus are the cause of exceeding the limit (but in fact they are not, which is 👍 )

Screenshot 2020-05-08 at 14 11 14

🔬 Minimal Reproduction

🔥 Exception or Error


ERROR in budgets: Exceeded maximum budget for initial. Budget 5 MB was not met by 270 kB with a total of 5.26 MB. 
The command '/bin/sh -c ng build --prod --source-map=false' returned a non-zero code: 1 

🌍 Your Environment


Angular CLI: 9.1.4
Node: 12.13.0
OS: darwin x64

Angular: 9.1.4
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.4
@angular-devkit/build-angular     0.901.4
@angular-devkit/build-optimizer   0.901.4
@angular-devkit/build-webpack     0.901.4
@angular-devkit/core              9.1.4
@angular-devkit/schematics        9.1.4
@angular/cdk                      9.2.2
@ngtools/webpack                  9.1.4
@schematics/angular               9.1.4
@schematics/update                0.901.4
rxjs                              6.5.5
typescript                        3.7.5
webpack                           4.42.0

@ngbot ngbot bot added this to the needsTriage milestone May 8, 2020
@alan-agius4 alan-agius4 added freq1: low Only reported by a handful of users who observe it rarely severity3: broken type: bug/fix labels May 8, 2020
@ngbot ngbot bot modified the milestones: needsTriage, Backlog May 8, 2020
@pusherman
Copy link

pusherman commented May 21, 2020

We are having the same issue which breaks our deployments. The issue, for me, does not happen when I am on @angular-devkit/build-angular@~0.900.6. It does present itself when I am on @angular-devkit/build-angular@~0.900.7

Broken

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.900.7
@angular-devkit/build-angular      0.900.7
@angular-devkit/build-optimizer    0.900.7
@angular-devkit/build-webpack      0.900.7
@angular-devkit/core               9.0.6
@angular-devkit/schematics         9.0.6
@angular/cdk                       9.2.4
@angular/flex-layout               9.0.0-beta.29
@angular/material                  9.2.4
@angular/material-moment-adapter   9.1.3
@ngtools/webpack                   9.0.7
@schematics/angular                9.0.6
@schematics/update                 0.900.6
rxjs                               6.5.4
typescript                         3.7.5
webpack                            4.41.2

Not Broken

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.900.6
@angular-devkit/build-angular      0.900.6
@angular-devkit/build-optimizer    0.900.6
@angular-devkit/build-webpack      0.900.6
@angular-devkit/core               9.0.6
@angular-devkit/schematics         9.0.6
@angular/cdk                       9.2.4
@angular/flex-layout               9.0.0-beta.29
@angular/material                  9.2.4
@angular/material-moment-adapter   9.1.3
@ngtools/webpack                   9.0.6
@schematics/angular                9.0.6
@schematics/update                 0.900.6
rxjs                               6.5.4
typescript                         3.7.5
webpack                            4.41.2

@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 Feb 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants