We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1e47657 commit 9b52253Copy full SHA for 9b52253
packages/@ngtools/webpack/src/loader.ts
@@ -262,8 +262,9 @@ function _removeModuleId(refactor: TypeScriptFileRefactor) {
262
263
function _getResourceRequest(element: ts.Expression, sourceFile: ts.SourceFile) {
264
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, '')}'`;
+ const url = (element as ts.StringLiteral).text;
+ // If the URL does not start with ./ or ../, prepends ./ to it.
267
+ return `'${/^\.?\.\//.test(url) ? '' : './'}${url}'`;
268
} else {
269
// if not string, just use expression directly
270
return element.getFullText(sourceFile);
0 commit comments