Closed
Description
Describe the bug
Everything works fine in development mode but when executing build command I get the following error
vite v7.0.0 building for production...
✓ 588 modules transformed.
✗ Build failed in 8.53s
error during build:
[vite]: Rollup failed to resolve import "prop-types" from "C:/Users/yangl/Documents/workspace/yanglee2421.github.io/node_modules/.pnpm/@mui+material@7.1.2_@emotio_9e006404fc3586f7b9058af5f597a2e0/node_modules/@mui/material/esm/Card/Card.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
at viteLog (file:///C:/Users/yangl/Documents/workspace/yanglee2421.github.io/node_modules/.pnpm/vite@7.0.0_@types+node@24.0_331d272363cbca6bf42d8fecdff3ce7a/node_modules/vite/dist/node/chunks/dep-Bsx9IwL8.js:34193:57)
at file:///C:/Users/yangl/Documents/workspace/yanglee2421.github.io/node_modules/.pnpm/vite@7.0.0_@types+node@24.0_331d272363cbca6bf42d8fecdff3ce7a/node_modules/vite/dist/node/chunks/dep-Bsx9IwL8.js:34231:73
at onwarn (file:///C:/Users/yangl/Documents/workspace/yanglee2421.github.io/node_modules/.pnpm/@vitejs+plugin-react@4.6.0__10cc47ad24867011aa08e24c53755116/node_modules/@vitejs/plugin-react/dist/index.mjs:104:9)
at file:///C:/Users/yangl/Documents/workspace/yanglee2421.github.io/node_modules/.pnpm/vite@7.0.0_@types+node@24.0_331d272363cbca6bf42d8fecdff3ce7a/node_modules/vite/dist/node/chunks/dep-Bsx9IwL8.js:34231:28
at onRollupLog (file:///C:/Users/yangl/Documents/workspace/yanglee2421.github.io/node_modules/.pnpm/vite@7.0.0_@types+node@24.0_331d272363cbca6bf42d8fecdff3ce7a/node_modules/vite/dist/node/chunks/dep-Bsx9IwL8.js:34226:3)
at onLog (file:///C:/Users/yangl/Documents/workspace/yanglee2421.github.io/node_modules/.pnpm/vite@7.0.0_@types+node@24.0_331d272363cbca6bf42d8fecdff3ce7a/node_modules/vite/dist/node/chunks/dep-Bsx9IwL8.js:34014:4)
at file:///C:/Users/yangl/Documents/workspace/yanglee2421.github.io/node_modules/.pnpm/rollup@4.44.0/node_modules/rollup/dist/es/shared/node-entry.js:20799:32
at Object.logger [as onLog] (file:///C:/Users/yangl/Documents/workspace/yanglee2421.github.io/node_modules/.pnpm/rollup@4.44.0/node_modules/rollup/dist/es/shared/node-entry.js:22679:9)
at ModuleLoader.handleInvalidResolvedId (file:///C:/Users/yangl/Documents/workspace/yanglee2421.github.io/node_modules/.pnpm/rollup@4.44.0/node_modules/rollup/dist/es/shared/node-entry.js:21425:26)
at file:///C:/Users/yangl/Documents/workspace/yanglee2421.github.io/node_modules/.pnpm/rollup@4.44.0/node_modules/rollup/dist/es/shared/node-entry.js:21383:26
ELIFECYCLE Command failed with exit code 1.
This problem seems to only occur on Windows platforms. It does not occur when I execute pnpm build in github actions (ubuntu-latest)
Reproduction
https://github.com/yanglee2421/yanglee2421.github.io
Steps to reproduce
- On Windows
- pnpm i
- pnpm build
System Info
System:
OS: Windows 11 10.0.26100
CPU: (12) x64 AMD Ryzen 5 7640HS w/ Radeon 760M Graphics
Memory: 4.01 GB / 15.18 GB
Binaries:
Node: 22.17.0 - C:\Program Files\nodejs\node.EXE
npm: 10.9.2 - C:\Program Files\nodejs\npm.CMD
pnpm: 10.12.3 - C:\Program Files\nodejs\pnpm.CMD
Browsers:
Edge: Chromium (132.0.2957.115)
npmPackages:
@vitejs/plugin-react: ^4.6.0 => 4.6.0
vite: ^7.0.0 => 7.0.0
Used Package Manager
pnpm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.