我尝试在vercel或netlify上部署我的react vite项目,但出现错误:
RollupError: Could not resolve "./reviews/Reviews" from "src/components/Pages/CarDetails/CarDetails.jsx"
at error (file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:2128:30)
at ModuleLoader.handleInvalidResolvedId (file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:23782:24)
at file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:23744:26
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Command "yarn run build" exited with 1
Deployment completed
BUILD_UTILS_SPAWN_1: Command "yarn run build" exited with 1
下面是我vite.config.js:
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
vite: {
server: {
watch: {
usePolling: true,
},
},
},
});
谷歌一下,但还是没有答案
1条答案
按热度按时间mspsb9vt1#
我遇到了同样的问题,它与从.tsx导入.jsx文件有关,当tsconfig.json compile_options配置为:
你可以改变这个配置到你想在编译时自动检测的配置。