Skip to content

Commit f2ff1a4

Browse files
committed
fix(@angular/cli): all styleUrls and templateUrl are relative
Fixes #5056.
1 parent d94040b commit f2ff1a4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/@ngtools/webpack/src/loader.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,11 @@ function _removeModuleId(refactor: TypeScriptFileRefactor) {
262262

263263
function _getResourceRequest(element: ts.Expression, sourceFile: ts.SourceFile) {
264264
if (element.kind == ts.SyntaxKind.StringLiteral) {
265-
// if string, assume relative path unless it start with /
266-
return `'${loaderUtils.urlToRequest((element as ts.StringLiteral).text, '')}'`;
265+
const url = (element as ts.StringLiteral).text;
266+
if (url[0] == '.') {
267+
return `'${url}'`;
268+
}
269+
return `'./${url}'`;
267270
} else {
268271
// if not string, just use expression directly
269272
return element.getFullText(sourceFile);

0 commit comments

Comments
 (0)