Skip to content

No fallback to index.js when importing a directory using an alias #15858

@charlesmass2

Description

@charlesmass2

Describe the bug

Importing a directory using import won't fallback to the index.js file anymore.
Get the following error:
image

I created a very simple repo for an easy reproduction.

I noticed that the issue started at version 5.1.0, more specifically with version 5.1.0-beta.4.

Reproduction

https://github.com/charlesmass2/vite-index-fallback-fail

Steps to reproduce

Run npm install followed by npm run dev

System Info

System:
    OS: Linux 6.5 Ubuntu 22.04.2 LTS 22.04.2 LTS (Jammy Jellyfish)
    CPU: (20) x64 13th Gen Intel(R) Core(TM) i7-13700H
    Memory: 7.28 GB / 31.05 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 20.3.1 - /usr/bin/node
    npm: 9.6.7 - /usr/bin/npm
  Browsers:
    Chrome: 121.0.6167.139
  npmPackages:
    @vitejs/plugin-vue: ^5.0.3 => 5.0.3 
    vite: 5.1.0 => 5.1.0

This is also reproduced in Alpine docker container.

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    p3-minor-bugAn edge case that only affects very specific usage (priority)regressionThe issue only appears after a new release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions