Skip to content

Commit fa175d8

Browse files
committed
fix(@angular/cli): correct CSS import fallback logic
1 parent 4a745c9 commit fa175d8

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,13 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
7272
loader.resolve(context, url, (err: Error, result: string) => {
7373
if (err) {
7474
reject(err);
75-
return;
75+
} else {
76+
resolve(result);
7677
}
77-
78-
resolve(result);
7978
});
79+
} else {
80+
resolve(result);
8081
}
81-
82-
resolve(result);
8382
});
8483
});
8584
},

tests/e2e/tests/build/styles/material-import.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,16 @@ export default function () {
2929
.then(() => replaceInFile('src/app/app.component.ts',
3030
'./app.component.css', `./app.component.${ext}`))
3131
// run build app
32-
.then(() => ng('build', '--extract-css', '--sourcemap'));
32+
.then(() => ng('build', '--extract-css', '--sourcemap'))
33+
.then(() => writeMultipleFiles({
34+
[`src/styles.${ext}`]: stripIndents`
35+
@import "@angular/material/prebuilt-themes/indigo-pink.css";
36+
`,
37+
[`src/app/app.component.${ext}`]: stripIndents`
38+
@import "@angular/material/prebuilt-themes/indigo-pink.css";
39+
`,
40+
}))
41+
.then(() => ng('build', '--extract-css'));
3342
});
3443
});
3544

0 commit comments

Comments
 (0)