Skip to content

Complex style configuration in angular.json not working with npm 'linked' CSS #17772

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
2 of 15 tasks
DavidUrting opened this issue May 20, 2020 · 2 comments
Closed
2 of 15 tasks

Comments

@DavidUrting
Copy link

🐞 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?

Not sure, this is the first time I have this situation.

Description

When using a 'complex' style configuration in angular.json in combination with a .css file coming from a linked NPM package the .css file is not bundled. When installing the NPM as a regular NPM package or when configuring a direct path to the .css the .css is bundled.

So in a nutshell, it seems that the 'complex' style configuration does not support NPM links.

🔬 Minimal Reproduction

  1. create an npm package in a directory /some-package. Add a .css file in /some-package/dist/some-package.css and a package.json. Name the package @company/some-package.
  2. create an Angular application in /application.
  3. add a link to 'some-package' int the dependencies section of the package.json of the application: "@company/some-package": "file:../some-package".
  4. Run npm install in /application.
  5. add a complex style configuration to angular.json that refers the css in the package:
            "styles": [
              "src/styles.scss",
              {
                "input": "node_modules/@company/some-package/dist/some-package.css",
                "bundleName": "some-package",
                "inject": true
              }
            ],

When running ng build or ng serve the css is not bundled and as such the styles are not applied.
When I refer the css directly it works:

            "styles": [
              "src/styles.scss",
              {
                "input": "../some-package/dist/some-package.css",
                "bundleName": "some-package",
                "inject": true
              }
            ],

A Github repository that reproduces the problem can be found on https://github.com/DavidUrting/angular-style-configuration-npm-link-issue.

🔥 Exception or Error


No errors/exceptions.

🌍 Your Environment




Angular CLI: 9.1.6
Node: 12.16.2
OS: win32 x64

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

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.6
@angular-devkit/build-angular     0.901.6
@angular-devkit/build-optimizer   0.901.6
@angular-devkit/build-webpack     0.901.6
@angular-devkit/core              9.1.6
@angular-devkit/schematics        9.1.6
@angular/cli                      9.1.6
@ngtools/webpack                  9.1.6
@schematics/angular               9.1.6
@schematics/update                0.901.6
rxjs                              6.5.5
typescript                        3.8.3
webpack                           4.42.0

Anything else relevant?

@alan-agius4
Copy link
Collaborator

Duplicate of #3500

@alan-agius4 alan-agius4 marked this as a duplicate of #3500 May 20, 2020
@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 Jun 20, 2020
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