Skip to content

fix(@angular/cli): ensure stylesheet relative tilde path conversion #9077

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

Merged
merged 1 commit into from
Jan 4, 2018

Conversation

clydin
Copy link
Member

@clydin clydin commented Jan 3, 2018

Fixes #9061

@clydin clydin added the blocked label Jan 3, 2018
@clydin clydin force-pushed the fix-tilde-absolute branch from 1f942b6 to bdc9ffb Compare January 3, 2018 21:47
@clydin clydin removed the blocked label Jan 3, 2018
@clydin clydin requested a review from filipesilva January 3, 2018 21:50
@clydin clydin assigned filipesilva and clydin and unassigned filipesilva Jan 3, 2018
filipesilva
filipesilva previously approved these changes Jan 3, 2018
@clydin clydin force-pushed the fix-tilde-absolute branch 2 times, most recently from e1773a6 to 6449e06 Compare January 4, 2018 03:51
@maa105
Copy link

maa105 commented Jan 4, 2018

I tried it by updating the file in the node_modules/@angular/cli/models/webpack-configs/styles.js but I got this weird error (same as before the update but the path changed to relative instead of absolute):

Module not found: Error: Can't resolve './....node_modules☼ont-awesome☼onts☼ontawesome-webfont.eot' in 'c:\Users<user_name>\Desktop<project>\src'
resolve './....node_modules☼ont-awesome☼onts☼ontawesome-webfont.eot' in 'c:\Users<username>\Desktop<project>\src'

it seems everything after the / is either missing or is suing some kind of escape sequence like "/f" in "/fontawesome" is displaying as "☼"

same thing with ioic icons:

Module not found: Error: Can't resolve './....node_modulesionic-angular☼ontsnoto-sans-bold.woff' in 'c:\Users<user_name>\Desktop<project>\src'
resolve './....node_modulesionic-angular☼ontsnoto-sans-bold.woff' in 'c:\Users<user_name>\Desktop<project>\src'

any ideas?

douglasduteil added a commit to douglasduteil/angular-cli that referenced this pull request Jan 4, 2018
Ensure that, on Windows, the path doesn't contain back slashes to be PostCSS friendly :)

Following angular#8791 
Closes angular#9077 angular#9061 angular#9080
douglasduteil added a commit to douglasduteil/angular-cli that referenced this pull request Jan 4, 2018
Ensure that, on Windows, the path doesn't contain back slashes to be PostCSS friendly :)

Following angular#8791
Closes angular#9077 angular#9061 angular#9080
@clydin clydin force-pushed the fix-tilde-absolute branch from 6449e06 to 699044b Compare January 4, 2018 13:20
@clydin clydin force-pushed the fix-tilde-absolute branch from 699044b to 3786b45 Compare January 4, 2018 13:23
@clydin clydin merged commit 0b890e4 into angular:master Jan 4, 2018
@clydin clydin deleted the fix-tilde-absolute branch January 4, 2018 14:39
@LosD
Copy link

LosD commented Jan 12, 2018

This seems to somehow have broken Material2 styles.css imports for me:

ERROR in ./node_modules/css-loader?{"sourceMap":false,"import":false}!./node_modules/postcss-loader/lib?{"ident":"postcss","sourceMap":false}!./src/styles.css
Module build failed: Error: Can't resolve '~@angular/material/prebuilt-themes/deeppurple-amber.css' in '/home/dennis/Projects/angular2frontend/src'
    at onError (/home/dennis/Projects/angular2frontend/node_modules/enhanced-resolve/lib/Resolver.js:61:15)
    at loggingCallbackWrapper (/home/dennis/Projects/angular2frontend/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at runAfter (/home/dennis/Projects/angular2frontend/node_modules/enhanced-resolve/lib/Resolver.js:158:4)
    at innerCallback (/home/dennis/Projects/angular2frontend/node_modules/enhanced-resolve/lib/Resolver.js:146:3)
    at loggingCallbackWrapper (/home/dennis/Projects/angular2frontend/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at next (/home/dennis/Projects/angular2frontend/node_modules/tapable/lib/Tapable.js:252:11)
    at /home/dennis/Projects/angular2frontend/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:40:4
    at loggingCallbackWrapper (/home/dennis/Projects/angular2frontend/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at runAfter (/home/dennis/Projects/angular2frontend/node_modules/enhanced-resolve/lib/Resolver.js:158:4)
    at innerCallback (/home/dennis/Projects/angular2frontend/node_modules/enhanced-resolve/lib/Resolver.js:146:3)
    at loggingCallbackWrapper (/home/dennis/Projects/angular2frontend/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at next (/home/dennis/Projects/angular2frontend/node_modules/tapable/lib/Tapable.js:252:11)
    at innerCallback (/home/dennis/Projects/angular2frontend/node_modules/enhanced-resolve/lib/Resolver.js:144:11)
    at loggingCallbackWrapper (/home/dennis/Projects/angular2frontend/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at next (/home/dennis/Projects/angular2frontend/node_modules/tapable/lib/Tapable.js:249:35)
    at resolver.doResolve.createInnerCallback (/home/dennis/Projects/angular2frontend/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:44:6)
 @ ./src/styles.css 4:14-138
 @ multi ./src/styles.css ./node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css

Worked until latest CLI release on my Ubuntu workstation.

Yes, the file is present:

ls /home/dennis/Projects/angular2frontend/node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css 
/home/dennis/Projects/angular2frontend/node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css

For anyone else running into the same: A workaround, at least for me, is simply to include the CSS directly in the .angular-cli.json styles. However, that is probably not going to help if dependencies has CSS files depending on each other.

@filipesilva
Copy link
Contributor

@LosD #9188 should address what you're seeing. It's not released yet but should be in the next release.

@LosD
Copy link

LosD commented Jan 15, 2018

@filipesilva Thanks. I also found the bug report (#9185), which has other nice workarounds. @clydin gave the simplest one: Just nuke the tilde. :)

@manimayan
Copy link

This is the easy way to get rid of "ERROR in ./node_modules/css-loader?{"sourceMap":false,"import":false}!."
Run the below:
npm install --save-dev @angular/[email protected]

@manimayan
Copy link

This is the easy way to get rid of "ERROR in ./node_modules/css-loader?{"sourceMap":false,"import":false}!."
Run the below:
npm install --save-dev @angular/[email protected]

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

Successfully merging this pull request may close these issues.

SASS/SCSS tilde reference no longer works with variables
6 participants