Skip to content

vite 8.0.0-beta.0 cannot resolve react dependency in Yarn PnP #543

@smeng9

Description

@smeng9

Describe the bug

I tried to start my development environment but it failed with the following error.

[plugin:vite:import-analysis] Failed to resolve import "react" from "src/main.tsx". Does the file exist?

Reproduction

vite.new/react-ts

Steps to reproduce

Download the template from vite.new/react-ts

Run yarn set version canary to use the latest version of yarn with PnP

Change vite dependency in package.json

Run yarn to install all dependencies

Run yarn dev to start the development environment and the error will show up

System Info

System:
    OS: macOS 26.1
    CPU: (8) arm64 Apple M2
    Memory: 81.50 MB / 16.00 GB
    Shell: 3.2.57 - /bin/sh
  Binaries:
    Node: 24.11.0 - /usr/local/bin/node
    Yarn: 4.12.0 - /usr/local/bin/yarn
    npm: 11.6.1 - /usr/local/bin/npm
  Browsers:
    Safari: 26.1

Used Package Manager

yarn

Logs

Plugin: vite:import-analysis
File: /Users/shaoyumeng/Downloads/vitejs-vite-rmp7t7yz/src/App.tsx:1:25
1 | import { useState } from "react";
| ^
2 | import reactLogo from "./assets/react.svg";
3 | import viteLogo from "/vite.svg";
2:03:25 PM [vite] (client) Pre-transform error: Failed to resolve import "react" from "src/App.tsx". Does the file exist?

Validations

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions