Fix #334 Vite run lower version
This commit is contained in:
parent
0d570f6c9e
commit
1a7870a9ed
|
|
@ -31,7 +31,6 @@
|
|||
"@tanstack/react-query-devtools": "^5.91.1",
|
||||
"@tanstack/react-virtual": "^3.13.18",
|
||||
"@types/node": "^25.5.0",
|
||||
"@vitejs/plugin-legacy": "^8.0.1",
|
||||
"@zxing/library": "^0.21.3",
|
||||
"antd": "^5.17.4",
|
||||
"antd-img-crop": "^4.22.0",
|
||||
|
|
@ -90,6 +89,7 @@
|
|||
"devDependencies": {
|
||||
"@types/react": "^18.3.3",
|
||||
"@types/react-dom": "^18.3.0",
|
||||
"@vitejs/plugin-legacy": "^8.0.0",
|
||||
"@vitejs/plugin-react": "^6.0.1",
|
||||
"esbuild": "^0.27.4",
|
||||
"eslint": "^8.57.0",
|
||||
|
|
@ -98,7 +98,7 @@
|
|||
"eslint-plugin-react-refresh": "^0.4.7",
|
||||
"prettier": "^3.5.3",
|
||||
"rollup-plugin-obfuscator": "^1.1.0",
|
||||
"sass": "^1.98.0",
|
||||
"sass": "^1.77.2",
|
||||
"terser": "^5.31.3",
|
||||
"vite": "^8.0.0",
|
||||
"vite-plugin-obfuscator": "^1.0.5",
|
||||
|
|
|
|||
|
|
@ -1,27 +1,66 @@
|
|||
import { defineConfig } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import legacy from '@vitejs/plugin-legacy';
|
||||
import esbuild from 'esbuild';
|
||||
|
||||
export default defineConfig(({ mode }) => {
|
||||
const isProd = mode === "production";
|
||||
const isProd = mode === 'production';
|
||||
|
||||
return {
|
||||
plugins: [react()],
|
||||
return {
|
||||
oxc: {
|
||||
target: 'es2015'
|
||||
},
|
||||
plugins: [
|
||||
react(),
|
||||
legacy({
|
||||
targets: [
|
||||
"defaults",
|
||||
"Android >= 5",
|
||||
"Chrome >= 60"
|
||||
],
|
||||
}),
|
||||
{
|
||||
name: 'downlevel-dev',
|
||||
enforce: 'post',
|
||||
async transform(code, id) {
|
||||
if (mode === 'development' && /\.(mjs|js|ts|jsx|tsx)(?:[?#]|$)/.test(id)) {
|
||||
try {
|
||||
const res = await esbuild.transform(code, { target: 'chrome64', loader: 'jsx' });
|
||||
return res.code;
|
||||
} catch (e) {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
base: isProd ? "/apps/retail/" : "/", //for capcitor base: isProd ? "/" : "/",
|
||||
base: '/',
|
||||
envDir: 'src',
|
||||
envPrefix: 'ENV_',
|
||||
|
||||
envDir: "src",
|
||||
envPrefix: "ENV_",
|
||||
server: {
|
||||
host: '0.0.0.0',
|
||||
port: process.env.PORT || 3015,
|
||||
|
||||
server: {
|
||||
host: true, // 🔥 auto detect your IP
|
||||
port: process.env.PORT || 3015,
|
||||
hmr: {
|
||||
host: '192.168.1.35',
|
||||
port: 3015,
|
||||
protocol: 'ws',
|
||||
clientPort: 3015,
|
||||
}
|
||||
},
|
||||
|
||||
optimizeDeps: {
|
||||
include: ['jspdf'],
|
||||
},
|
||||
|
||||
build: {
|
||||
minify: "esbuild",
|
||||
target: 'es2015',
|
||||
minify: 'esbuild',
|
||||
esbuild: {
|
||||
drop: isProd ? ["console", "debugger"] : [],
|
||||
drop: isProd ? ['console', 'debugger'] : [],
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
});
|
||||
Loading…
Reference in New Issue