Skip to content

Commit 6fbce68

Browse files
committed
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 6fbce68

File tree

1 file changed

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

1 file changed

+7
-1
lines changed

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

+7-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,13 @@ 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
55+
// be PostCSS friendly :)
56+
.replace(/\\/g, '/');
57+
},
5258
}),
5359
postcssUrl([
5460
{

0 commit comments

Comments
 (0)