Skip to content

Vite cannot load vite.config.ts with Node 17 and vite@4.4.0-beta.3 #13631

@brillout

Description

@brillout

Describe the bug

When running $ vite build Vite throws this error:

$ pnpm build

> @ build /home/rom/tmp/vite-ssr-project
> vite build

failed to load config from /home/rom/tmp/vite-ssr-project/vite.config.ts
error during build:
Error: The URL must be of scheme file at /home/rom/tmp/vite-ssr-project/vite.config.ts
    at loadConfigFromBundledFile (file:///home/rom/tmp/vite-ssr-project/node_modules/.pnpm/vite@4.4.0-beta.3_@types+node@18.16.18/node_modules/vite/dist/node/chunks/dep-64acfab2.js:65812:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async loadConfigFromFile (file:///home/rom/tmp/vite-ssr-project/node_modules/.pnpm/vite@4.4.0-beta.3_@types+node@18.16.18/node_modules/vite/dist/node/chunks/dep-64acfab2.js:65661:28)
    at async resolveConfig (file:///home/rom/tmp/vite-ssr-project/node_modules/.pnpm/vite@4.4.0-beta.3_@types+node@18.16.18/node_modules/vite/dist/node/chunks/dep-64acfab2.js:65265:28)
    at async build (file:///home/rom/tmp/vite-ssr-project/node_modules/.pnpm/vite@4.4.0-beta.3_@types+node@18.16.18/node_modules/vite/dist/node/chunks/dep-64acfab2.js:47494:20)
    at async CAC.<anonymous> (file:///home/rom/tmp/vite-ssr-project/node_modules/.pnpm/vite@4.4.0-beta.3_@types+node@18.16.18/node_modules/vite/dist/node/cli.js:812:9)
 ELIFECYCLE  Command failed with exit code 1.

Reproduction

https://github.com/brillout/vite-reproduction-cannot-load-config

Steps to reproduce

See readme of reproduction.

System Info

System:
    OS: Linux 4.14 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
    CPU: (2) x64 Intel(R) Celeron(R) N4020 CPU @ 1.10GHz
    Memory: 102.18 MB / 3.72 GB
    Container: Yes
    Shell: 5.1.4 - /bin/bash
  Binaries:
    Node: 17.9.1 - ~/.nvm/versions/node/v17.9.1/bin/node
    npm: 8.11.0 - ~/.nvm/versions/node/v17.9.1/bin/npm
  npmPackages:
    @vitejs/plugin-react: ^3.0.0 => 3.1.0 
    vite: 4.4.0-beta.3 => 4.4.0-beta.3

Used Package Manager

pnpm

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