From 619d6506ea67136291a6d2c5a7014f9f09e7f7d3 Mon Sep 17 00:00:00 2001 From: c4lyp5o Date: Wed, 8 Nov 2023 16:51:04 +0800 Subject: [PATCH] fix: vite config optimization --- vite.config.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/vite.config.js b/vite.config.js index 973319b..93e88b6 100644 --- a/vite.config.js +++ b/vite.config.js @@ -3,6 +3,20 @@ import react from '@vitejs/plugin-react-swc'; // https://vitejs.dev/config/ export default defineConfig({ + optimizeDeps: { + include: [ + 'react', + 'react-dom', + 'react-router-dom', + 'axios', + 'react-toastify', + ], + esbuildOptions: { + loader: { + '.js': 'jsx', + }, + }, + }, server: { // port for exposing frontend port: 3000, @@ -25,8 +39,9 @@ export default defineConfig({ output: { manualChunks: { react: ['react'], - axios: ['axios'], + 'react-dom': ['react-dom'], 'react-router-dom': ['react-router-dom'], + axios: ['axios'], 'react-toastify': ['react-toastify'], }, },