Skip to content

Commit

Permalink
resolve components helpers with explicit extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklx committed Dec 9, 2023
1 parent a58c41b commit a12e437
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions packages/core/src/module-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,22 +532,25 @@ export class Resolver {
}

private *componentTemplateCandidates(inPackageName: string) {
yield { prefix: '/templates/components/', suffix: '' };
yield { prefix: '/components/', suffix: '/template' };
yield { prefix: '/templates/components/', suffix: '.hbs' };
yield { prefix: '/components/', suffix: '/template.hbs' };

let pods = this.podPrefix(inPackageName);
if (pods) {
yield { prefix: `${pods}/components/`, suffix: '/template' };
yield { prefix: `${pods}/components/`, suffix: '/template.hbs' };
}
}

private *componentJSCandidates(inPackageName: string) {
yield { prefix: '/components/', suffix: '' };
yield { prefix: '/components/', suffix: '/component' };
yield { prefix: '/components/', suffix: '.js' };
yield { prefix: '/components/', suffix: '.ts' };
yield { prefix: '/components/', suffix: '/component.js' };
yield { prefix: '/components/', suffix: '/component.ts' };

let pods = this.podPrefix(inPackageName);
if (pods) {
yield { prefix: `${pods}/components/`, suffix: '/component' };
yield { prefix: `${pods}/components/`, suffix: '/component.js' };
yield { prefix: `${pods}/components/`, suffix: '/component.ts' };
}
}

Expand Down Expand Up @@ -1152,7 +1155,7 @@ export class Resolver {
if (filename.match(/\.(hbs|js|hbs\.js)$/)) {
yield filename;
} else {
for (let ext of ['.js', '.hbs.js', '.hbs']) {
for (let ext of ['.js', '.hbs.js', '.hbs', '.ts']) {
yield `${filename}${ext}`;
}
}
Expand Down

0 comments on commit a12e437

Please sign in to comment.