Skip to content

Commit 324669c

Browse files
authored
fix: allow resolving bare specifiers to relative paths for entries (#20379)
1 parent 5e29602 commit 324669c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

packages/vite/src/node/optimizer/scan.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ async function computeEntries(environment: ScanEnvironment) {
237237
p,
238238
path.join(process.cwd(), '*'),
239239
{
240+
isEntry: true,
240241
scan: true,
241242
},
242243
)

packages/vite/src/node/plugins/resolve.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,9 @@ export function resolvePlugin(
254254
// relative
255255
if (
256256
id[0] === '.' ||
257-
((preferRelative || importer?.endsWith('.html')) &&
257+
((preferRelative ||
258+
resolveOpts.isEntry ||
259+
importer?.endsWith('.html')) &&
258260
startsWithWordCharRE.test(id))
259261
) {
260262
const basedir = importer ? path.dirname(importer) : process.cwd()

0 commit comments

Comments
 (0)