80 lines
1.9 KiB
TypeScript
80 lines
1.9 KiB
TypeScript
import path from 'node:path';
|
|
import react from '@vitejs/plugin-react';
|
|
import { defineConfig, loadEnv } from 'vite';
|
|
import { VitePWA } from 'vite-plugin-pwa';
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig(({ mode }) => {
|
|
const env = loadEnv(mode, process.cwd());
|
|
return {
|
|
build: {
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks: {
|
|
reactIcons: ['react-icons/fi', 'react-icons/fa', 'react-icons/wi'],
|
|
reactIconsSi: ['react-icons/si'],
|
|
reactIconsFa6: ['react-icons/fa6'],
|
|
reactIconsVsc: ['react-icons/vsc'],
|
|
mantine: ['@mantine/core', '@mantine/hooks'],
|
|
tanstack: [
|
|
'@tanstack/react-query',
|
|
'@tanstack/react-query-devtools',
|
|
'@tanstack/react-query-persist-client',
|
|
],
|
|
utils: ['@hello-pangea/dnd', 'recharts', 'react-toastify', 'jotai'],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
plugins: [
|
|
react(),
|
|
VitePWA({
|
|
srcDir: "src",
|
|
filename: "service-worker.ts",
|
|
strategies: "injectManifest",
|
|
injectRegister: false,
|
|
manifest: false,
|
|
injectManifest: {
|
|
injectionPoint: undefined,
|
|
},
|
|
workbox: {
|
|
maximumFileSizeToCacheInBytes: 10 * 1024 * 1024,
|
|
globPatterns: ['**/*.{ts,js,css,html,ico,png,svg}']
|
|
}
|
|
})
|
|
],
|
|
server: {
|
|
port: 3000,
|
|
host: '0.0.0.0',
|
|
proxy: {
|
|
'/api': {
|
|
target: `${env.VITE_DOMAIN_DEV}/${env.VITE_BASE_URL}`,
|
|
changeOrigin: false,
|
|
secure: false,
|
|
},
|
|
},
|
|
},
|
|
preview: {
|
|
port: 3000,
|
|
host: '0.0.0.0',
|
|
proxy: {
|
|
api: {
|
|
target: `${env.VITE_DOMAIN_DEV}`,
|
|
changeOrigin: false,
|
|
secure: false,
|
|
},
|
|
},
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
components: path.resolve(__dirname, './src/components'),
|
|
hooks: path.resolve(__dirname, './src/hooks'),
|
|
pages: path.resolve(__dirname, './src/pages'),
|
|
styles: path.resolve(__dirname, './src/styles'),
|
|
types: path.resolve(__dirname, './src/types'),
|
|
contexts: path.resolve(__dirname, './src/contexts'),
|
|
},
|
|
},
|
|
};
|
|
});
|