Skip to content

Styles, @import'ed in styles.scss are not tree-shaked. #22809

@Lonli-Lokli

Description

@Lonli-Lokli

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

No sure

Description

Any SCSS styles imported with @import remains in styles.css for production build with styles optimization

🔬 Minimal Reproduction

https://github.com/Lonli-Lokli/scss-ts

  • Clone
  • run ng build --prod

Expected - no ngx-toastr styles as we have styles optimization turned on
Current - all styles are presented

🌍 Your Environment


Angular CLI: 13.2.5
Node: 14.18.2
Package Manager: npm 6.14.15
OS: win32 x64

Angular: 13.2.5
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1302.5
@angular-devkit/build-angular   13.2.5
@angular-devkit/core            13.2.5
@angular-devkit/schematics      13.2.5
@schematics/angular             13.2.5
rxjs                            7.5.4
typescript                      4.5.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions