feat: use vite for faster build

This commit is contained in:
ckt1031 2023-07-31 22:17:07 +08:00
parent 30a7f1a1c7
commit 0a4b4316c8
3 changed files with 30 additions and 6 deletions

View File

@ -14,5 +14,6 @@
<body> <body>
<noscript>You need to enable JavaScript to run this app.</noscript> <noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div> <div id="root"></div>
<script type="module" src="/src/index.js"></script>
</body> </body>
</html> </html>

View File

@ -3,6 +3,7 @@
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"dependencies": { "dependencies": {
"@vitejs/plugin-react": "^4.0.3",
"axios": "^0.27.2", "axios": "^0.27.2",
"history": "^5.3.0", "history": "^5.3.0",
"marked": "^4.1.1", "marked": "^4.1.1",
@ -10,17 +11,16 @@
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-dropzone": "^14.2.3", "react-dropzone": "^14.2.3",
"react-router-dom": "^6.3.0", "react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"react-toastify": "^9.0.8", "react-toastify": "^9.0.8",
"react-turnstile": "^1.0.5", "react-turnstile": "^1.0.5",
"semantic-ui-css": "^2.5.0", "semantic-ui-css": "^2.5.0",
"semantic-ui-react": "^2.1.3" "semantic-ui-react": "^2.1.3",
"vite": "^4.4.7",
"vite-plugin-env-compatible": "^1.1.1"
}, },
"scripts": { "scripts": {
"start": "react-scripts start", "start": "vite preview",
"build": "react-scripts build", "build": "vite build"
"test": "react-scripts test",
"eject": "react-scripts eject"
}, },
"eslintConfig": { "eslintConfig": {
"extends": [ "extends": [

23
web/vite.config.js Normal file
View File

@ -0,0 +1,23 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import envCompatible from 'vite-plugin-env-compatible'
export default defineConfig({
plugins: [
react(),
envCompatible({
prefix: "REACT_APP_",
mountedPath: "process.env",
}),
],
build: {
outDir: "build"
},
esbuild: {
loader: "tsx",
include: [
"src/**/*.js",
],
exclude: [],
}
})