Vite + React build fails
See original GitHub issuevite.config.ts
import { defineConfig } from 'vite'
import reactRefresh from '@vitejs/plugin-react-refresh'
import tsconfigPaths from 'vite-tsconfig-paths'
import Icons from 'unplugin-icons/vite'
import { visualizer } from 'rollup-plugin-visualizer'
export default defineConfig({
plugins: [
reactRefresh(),
tsconfigPaths(),
Icons({ compiler: 'jsx', jsx: 'react' }),
visualizer()
]
})
tsconfig.json
{
"compilerOptions": {
"baseUrl": "./src",
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": false,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react",
"types": ["unplugin-icons/types/react"]
},
"include": ["./src"]
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:16
Top Results From Across the Web
npm run build error with vite (typescript) - Stack Overflow
My environment works when I am in develop mode, but I get some react-router-dom errors when I start the build via vite.
Read more >Vite build fails when library has React code in a ".ts" file #13
Describe the bug Vite build for our application started failing after upgrading @vitejs/plugin-react from 2.0.0 to 2.0.1.
Read more >Build error when deploying React + Vite - Netlify Support Forums
Hello,. I am deploying my site to Netlify by way of Github and I am receiving and error when I try to deploy...
Read more >Troubleshooting - Vite
Also if there is a dependency loop, a full reload will happen. To solve this, try removing the loop. Build #. Built file...
Read more >Minified React error in production with Vite.js - Fredrik Bergqvist
So I converted it to TypeScript and ripped out the old babel/webpack build system and installed Vite to handle all the builds. Everything...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@oferitz if you’re using vite just try
vite build
, should work (vite should transform before building).@userquin Thanks, finally we understand each other 😃 so just that you know running with
tsc
will fail and that’s what my issue is all about, Maybe it worth taking a look on why. Thank you so much for the quick response and the time you took trying to help 🙏