Skip to content

Commit daed2b1

Browse files
fix(@angular/cli): Windows friendly tilde path resolution
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
1 parent 1c78ff1 commit daed2b1

File tree

1 file changed

+6
-1
lines changed
  • packages/@angular/cli/models/webpack-configs

1 file changed

+6
-1
lines changed

packages/@angular/cli/models/webpack-configs/styles.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
4848
return [
4949
postcssUrl({
5050
filter: ({ url }: { url: string }) => url.startsWith('~'),
51-
url: ({ url }: { url: string }) => path.join(projectRoot, 'node_modules', url.substr(1)),
51+
url: ({ url }: { url: string }, { file }: { file: string }) => {
52+
const relativePathToRoot = path.relative(file, projectRoot);
53+
return path.join(relativePathToRoot, 'node_modules', url.substr(1))
54+
// Ensure that, on Windows, the path doesn't contain back slashes to be PostCSS friendly :)
55+
.replace(/\\/g, '/');
56+
},
5257
}),
5358
postcssUrl([
5459
{

0 commit comments

Comments
 (0)