Skip to content

transitive deps excluded from deps pre-bundling is resolved from the project instead of the original importer #21088

Description

@brillout

Describe the bug

I stumbled upon what seems to be a bug with Vite's pre-bundling.

Reproduction

https://github.com/brillout/repro_vite-bug_pre-bundling

Steps to reproduce

No response

System Info

System:
    OS: Linux 6.8 Ubuntu 24.04.3 LTS 24.04.3 LTS (Noble Numbat)
    CPU: (8) x64 Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
    Memory: 1.90 GB / 7.52 GB
    Container: Yes
    Shell: 5.2.21 - /bin/bash
  Binaries:
    Node: 22.14.0 - /home/rom/.nvm/versions/node/v22.14.0/bin/node
    Yarn: 1.22.22 - /home/rom/.nix-profile/bin/yarn
    npm: 10.9.2 - /home/rom/.nvm/versions/node/v22.14.0/bin/npm
    pnpm: 10.14.0 - /home/rom/.nvm/versions/node/v22.14.0/bin/pnpm
    bun: 1.1.24 - /home/rom/.bun/bin/bun
    Deno: 1.44.4 - /home/rom/.nix-profile/bin/deno
    Watchman: 2024.03.11.00 - /home/rom/.nix-profile/bin/watchman
  Browsers:
    Chrome: 142.0.7444.59
    Firefox: 144.0.2
    Firefox Developer Edition: 144.0.2
  npmPackages:
    @vitejs/plugin-react: ^5.1.0 => 5.1.0 
    vite: ^7.1.12 => 7.2.2

Used Package Manager

pnpm

Logs

11:06:01 PM [vite] Failed to transpile /node_modules/.vite/deps/chunk-4QQOITFC.js because:
Failed to resolve import "@brillout/picocolors" from "node_modules/.vite/deps/chunk-4QQOITFC.js?v=8221fd8c". Does the file exist?
48 |  
49 |  // node_modules/.pnpm/telefunc@0.2.15_@babel+core@7.28.5_@babel+parser@7.28.5_@babel+types@7.28.5_react@19.2.0_vite@7...
50 |  import pc from "@brillout/picocolors";
   |                  ^
51 |  var errorPrefix = `[telefunc@${projectInfo.projectVersion}]`;
52 |  var internalErrorPrefix = red(`${errorPrefix}[Bug]`);
Image

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: deps optimizerDependencies Optimizationp3-minor-bugAn edge case that only affects very specific usage (priority)

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions