diff --git a/packages/build/src/source/resource/Reader.ts b/packages/build/src/source/resource/Reader.ts index f79dcc2e..9990fce1 100644 --- a/packages/build/src/source/resource/Reader.ts +++ b/packages/build/src/source/resource/Reader.ts @@ -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); diff --git a/packages/build/src/source/segment/Reader.ts b/packages/build/src/source/segment/Reader.ts index 38eb4d57..b10f361e 100644 --- a/packages/build/src/source/segment/Reader.ts +++ b/packages/build/src/source/segment/Reader.ts @@ -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);