Skip to content

Commit

Permalink
#572: index resolution for resources and segments
Browse files Browse the repository at this point in the history
  • Loading branch information
basmasking committed Dec 25, 2024
1 parent 58a4dc9 commit ad5a900
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/build/src/source/resource/Reader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ export default class ResourceReader

#makeResourceFilename(filename: string): string
{
const fullFilename = this.#fileHelper.assureExtension(filename);
const fullFilename = this.#fileManager.isDirectory(filename)
? `${filename}/index.js`
: this.#fileHelper.assureExtension(filename);

if (fullFilename.startsWith('./')) return fullFilename.substring(2);
if (fullFilename.startsWith('/')) return fullFilename.substring(1);
Expand Down
4 changes: 3 additions & 1 deletion packages/build/src/source/segment/Reader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ export default class SegmentReader

#makeModuleFilename(filename: string): string
{
const fullFilename = this.#fileHelper.assureExtension(filename);
const fullFilename = this.#fileManager.isDirectory(filename)
? `${filename}/index.js`
: this.#fileHelper.assureExtension(filename);

if (fullFilename.startsWith('./')) return fullFilename.substring(2);
if (fullFilename.startsWith('/')) return fullFilename.substring(1);
Expand Down

0 comments on commit ad5a900

Please sign in to comment.