Skip to content

sass directory index import fails in some cases after #17909 #17959

Closed
@hi-ogawa

Description

@hi-ogawa

Describe the bug

This is a regression of #17909
@userquin found an issue when testing pkg-pr-new release for vuetify https://github.com/userquin/vuetify-vite-modern-sass/

I'm still not sure if this is Vite side bug. This could be due to some inconsistency of how sass triggers custom importers.

// src/main.scss
@import "/src/test.scss";  // no issue if @import "./test.scss"

// src/test.scss
@import "./dir";

// src/dir/index.scss
.test {}

Reproduction

https://github.com/hi-ogawa/reproductions/tree/main/vite-17909-sass-import-directory-index

Steps to reproduce

For some reason, the error doesn't happen on stackblitz.

npx tiged hi-ogawa/reproductions/vite-17909-sass-import-directory-index repro
cd repro
npm i
npm run build # or dev

x Build failed in 151ms
error during build:
[vite:css] [sass] EISDIR: illegal operation on a directory, read
  ╷
1 │ @import "./dir"
  │         ^^^^^^^
  ╵
  src/test.scss 1:9  @import
  src/main.scss 5:9  root stylesheet
file: /home/hiroshi/code/personal/reproductions/repro/src/main.scss

System Info

System:
    OS: Linux 6.10 Arch Linux
    CPU: (16) x64 12th Gen Intel(R) Core(TM) i7-12650H
    Memory: 23.41 GB / 31.06 GB
    Container: Yes
    Shell: 5.2.32 - /usr/bin/bash
  Binaries:
    Node: 20.16.0 - ~/.volta/tools/image/node/20.16.0/bin/node
    npm: 10.8.1 - ~/.volta/tools/image/node/20.16.0/bin/npm
    pnpm: 9.8.0 - ~/.volta/bin/pnpm
  Browsers:
    Chromium: 128.0.6613.36
  npmPackages:
    vite: https://pkg.pr.new/vite@561b940 => 5.4.2

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions