I am building react app using vite.
I run the following command, the preview show everything is working.
npm run build
npm run preview
But when I transfer to the IIS or tomcat server, it show blank page without any error.
Not sure what is happen?
The only different when I deploy to web server I put it into a folder example C:\inetpub\wwwroot\example
Below is my vite.config.ts:
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import viteTsconfigPaths from 'vite-tsconfig-paths';
import svgrPlugin from 'vite-plugin-svgr';
import { fileURLToPath, URL } from 'url';
// https://vitejs.dev/config/
export default defineConfig({
server: {
port: 3000
},
plugins: [
react(), viteTsconfigPaths(), svgrPlugin()
],
define: {
"global": {},
},
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
mainFields: [],
},
css: {
preprocessorOptions: {
scss: {
// example : additionalData: `@import "./src/styles/variables";`
// There is need to include the .scss file extensions.
// additionalData: `@import "./src/styles/variables";`,
},
},
},
base: './',
});