You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"styles.css" and all other files in the "apps/styles" section of ".angular-cli.json" are ignored when running angular-cli from a path under a Windows 10 junction/directory symlink #6414
@sumitarora So, to be clear, the "background-color: red" style is actually used when you do the exact steps above? For me, it doesn't show up at all. Using ng build rather than ng serve doesn't work either. That does put this line ...
exports.push([module.i, "/* You can add global styles to this file, and also import other style files */\nh1 { background-color: red } \n", ""]);
... in styles.bundles.js, but it does not seem to be used, and does not affect the styles.
I've uninstalled angular-cli and reinstalled various versions, multiple times. Is there anything else I can try?
I have the problem when I run this full sequence of commands:
npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@latest
ng new style-test-app
cd style-test-app
echo h1 { background-color: red } >> src/styles.css
cat src/styles.css
ng serve
changed the title [-]styles.css" (and all other files in the "apps/styles" section of ".angular-cli.json") is ignored[/-][+]"styles.css" and all other files in the "apps/styles" section of ".angular-cli.json" are ignored[/+]on May 23, 2017
OK, I was able to make it work here. This seems to be a problem with angular-cli and Windows 10 junctions and/or directory symbolic links (created with MKLINK /J or MKLINK /D).
On my system, these files exist in a folder C:\Code\angular\style-test-app. C:\Code is an NTFS junction to C:\Users\<username>\Documents\Code:
C:\>dir *code*
Volume in drive C is System
Directory of C:\
03/30/2017 10:50 PM <JUNCTION> Code [C:\Users\<username>\Documents\Code]
If I run ng serve or ng build in C:\Code\angular\style-test-app (where I normally access these files) then the styles are not used. (I also tried a Windows 10 symbolic link (MKLINK /D) and experienced exactly the same problem.)
However, if I run ng serve from C:\Users\<username>\My Documents\Code\angular\style-test-app instead, then the styles are used. Everything works!
It is definitely reading the file and processing styles.css in both cases, but in different ways (if I delete it, ng serve gives an error that it's missing, and ng build definitely pulls it into styles.bundles.js).
ng build produces very different output on the two situations. In the junction/symlink case, for example, it produces a gigantic (>2MB) main.bundle.js file, but in the plain directory case, it produces a tiny (6KB) main.bundle.js file and a 2MB vendor.bundle.js file (which does not exist in the symlink case).
The output of ng build --verbose from C:\Users\<username>\Documents\Code\angular\style-test-app (directory):
changed the title [-]"styles.css" and all other files in the "apps/styles" section of ".angular-cli.json" are ignored[/-][+]"styles.css" and all other files in the "apps/styles" section of ".angular-cli.json" are ignored when running angular-cli from a path under a Windows 10 junction/directory symlink[/+]on May 23, 2017
Then, run from either the directory symlink or junction, and the styles are not used:
c:
cd \ng-link\style-test-app
ng serve
or
c:
cd \ng-junction\style-test-app
ng serve
Can replace ng serve with ng build and the resulting outputs are different (as in my previous comment), and the styles are used in the directory case but not in the junction or directory symlink case.
Activity
sumitarora commentedon May 23, 2017
@RobertSundling Just tried to replicate the issue, seems to be working fine. Is there anything else I can do to reproduce?
RobertSundling commentedon May 23, 2017
@sumitarora So, to be clear, the "background-color: red" style is actually used when you do the exact steps above? For me, it doesn't show up at all. Using
ng buildrather thanng servedoesn't work either. That does put this line ...... in
styles.bundles.js, but it does not seem to be used, and does not affect the styles.I've uninstalled angular-cli and reinstalled various versions, multiple times. Is there anything else I can try?
I have the problem when I run this full sequence of commands:
[-]styles.css" (and all other files in the "apps/styles" section of ".angular-cli.json") is ignored[/-][+]"styles.css" and all other files in the "apps/styles" section of ".angular-cli.json" are ignored[/+]RobertSundling commentedon May 23, 2017
OK, I was able to make it work here. This seems to be a problem with angular-cli and Windows 10 junctions and/or directory symbolic links (created with
MKLINK /JorMKLINK /D).On my system, these files exist in a folder
C:\Code\angular\style-test-app.C:\Codeis an NTFS junction toC:\Users\<username>\Documents\Code:If I run
ng serveorng buildinC:\Code\angular\style-test-app(where I normally access these files) then the styles are not used. (I also tried a Windows 10 symbolic link (MKLINK /D) and experienced exactly the same problem.)However, if I run
ng servefromC:\Users\<username>\My Documents\Code\angular\style-test-appinstead, then the styles are used. Everything works!It is definitely reading the file and processing
styles.cssin both cases, but in different ways (if I delete it,ng servegives an error that it's missing, andng builddefinitely pulls it intostyles.bundles.js).ng buildproduces very different output on the two situations. In the junction/symlink case, for example, it produces a gigantic (>2MB)main.bundle.jsfile, but in the plain directory case, it produces a tiny (6KB)main.bundle.jsfile and a 2MBvendor.bundle.jsfile (which does not exist in the symlink case).The output of
ng build --verbosefromC:\Users\<username>\Documents\Code\angular\style-test-app(directory):The output of
ng build --verbosefromC:\Code\angular\style-test-app(junction/symlink):Perhaps some alternate webpack option is automatically being applied if the current path is under a junction/symlink which breaks the styles?
[-]"styles.css" and all other files in the "apps/styles" section of ".angular-cli.json" are ignored[/-][+]"styles.css" and all other files in the "apps/styles" section of ".angular-cli.json" are ignored when running angular-cli from a path under a Windows 10 junction/directory symlink[/+]RobertSundling commentedon May 23, 2017
Full steps to reproduce on Windows
Initialize the project:
Verify that the project correctly uses the styles when served from that directory:
Next, create a junction and/or a directory symlink (must run with elevated privileges):
Then, run from either the directory symlink or junction, and the styles are not used:
or
Can replace
ng servewithng buildand the resulting outputs are different (as in my previous comment), and the styles are used in the directory case but not in the junction or directory symlink case.filipesilva commentedon May 24, 2017
Dupe of #2726, fixed in #6403.
angular-automatic-lock-bot commentedon Sep 7, 2019
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.