0
0
mirror of https://github.com/honojs/hono.git synced 2024-11-21 18:18:57 +01:00

fix(build): improve addExtension esbuild plugin (#3405)

This commit is contained in:
Yoshiya Hinosawa 2024-09-11 22:43:33 +09:00 committed by GitHub
parent 73ff6c0e82
commit 85c7dc6263
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -41,7 +41,11 @@ const addExtension = (extension: string = '.js', fileExtension: string = '.ts'):
} else { } else {
tsPath = path.join(args.resolveDir, args.path, `index${fileExtension}`) tsPath = path.join(args.resolveDir, args.path, `index${fileExtension}`)
if (fs.existsSync(tsPath)) { if (fs.existsSync(tsPath)) {
importPath = `${args.path}/index${extension}` if (args.path.endsWith('/')) {
importPath = `${args.path}index${extension}`
} else {
importPath = `${args.path}/index${extension}`
}
} }
} }
return { path: importPath, external: true } return { path: importPath, external: true }