🔧 chore(vite): update vite config
parent
34547c4849
commit
352fdac2ec
2212
javascript/main.js
2212
javascript/main.js
File diff suppressed because one or more lines are too long
|
|
@ -78,6 +78,8 @@
|
|||
"ahooks": "^3",
|
||||
"antd": "^5",
|
||||
"antd-style": "latest",
|
||||
"babel-plugin-antd-style": "^1",
|
||||
"babel-plugin-styled-components": "^2",
|
||||
"commitlint": "^17",
|
||||
"concurrently": "^8",
|
||||
"eslint": "^8",
|
||||
|
|
@ -101,14 +103,13 @@
|
|||
"react-tag-input": "^6",
|
||||
"remark": "^14",
|
||||
"remark-cli": "^11",
|
||||
"rollup-plugin-terser": "^7",
|
||||
"semantic-release": "^21",
|
||||
"shiki-es": "^0",
|
||||
"styled-components": "^6",
|
||||
"stylelint": "^15",
|
||||
"terser": "^5",
|
||||
"typescript": "^5",
|
||||
"vite": "^4",
|
||||
"webpack-shell-plugin-next": "^2",
|
||||
"zustand": "^4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
import react from '@vitejs/plugin-react';
|
||||
import { resolve } from 'node:path';
|
||||
import * as process from 'node:process';
|
||||
// @ts-ignore
|
||||
import { terser } from 'rollup-plugin-terser';
|
||||
import { defineConfig } from 'vite';
|
||||
|
||||
const isProduction = process.env.NODE_ENV === 'production';
|
||||
|
|
@ -12,6 +10,8 @@ const SD_PORT = 7860;
|
|||
export default defineConfig({
|
||||
base: '/dev',
|
||||
build: {
|
||||
cssMinify: true,
|
||||
minify: 'terser',
|
||||
outDir: './javascript',
|
||||
rollupOptions: {
|
||||
input: resolve(__dirname, 'src/main.tsx'),
|
||||
|
|
@ -20,32 +20,29 @@ export default defineConfig({
|
|||
chunkFileNames: `[name].js`,
|
||||
entryFileNames: `[name].js`,
|
||||
},
|
||||
plugins: [
|
||||
isProduction &&
|
||||
terser({
|
||||
compress: {
|
||||
arguments: true,
|
||||
drop_console: true,
|
||||
hoist_funs: true,
|
||||
hoist_props: true,
|
||||
hoist_vars: true,
|
||||
inline: true,
|
||||
keep_fargs: false,
|
||||
keep_fnames: false,
|
||||
keep_infinity: false,
|
||||
loops: true,
|
||||
passes: 3,
|
||||
pure_funcs: [],
|
||||
pure_getters: true,
|
||||
reduce_vars: true,
|
||||
sequences: true,
|
||||
unused: true,
|
||||
},
|
||||
format: {
|
||||
comments: false,
|
||||
},
|
||||
}),
|
||||
],
|
||||
},
|
||||
terserOptions: {
|
||||
compress: {
|
||||
arguments: true,
|
||||
drop_console: true,
|
||||
hoist_funs: true,
|
||||
hoist_props: true,
|
||||
hoist_vars: true,
|
||||
inline: true,
|
||||
keep_fargs: false,
|
||||
keep_fnames: false,
|
||||
keep_infinity: false,
|
||||
loops: true,
|
||||
passes: 3,
|
||||
pure_funcs: [],
|
||||
pure_getters: true,
|
||||
reduce_vars: true,
|
||||
sequences: true,
|
||||
unused: true,
|
||||
},
|
||||
format: {
|
||||
comments: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
define: {
|
||||
|
|
@ -54,7 +51,19 @@ export default defineConfig({
|
|||
plugins: [
|
||||
react({
|
||||
babel: {
|
||||
plugins: ['@babel/plugin-syntax-import-assertions'],
|
||||
plugins: [
|
||||
'@babel/plugin-syntax-import-assertions',
|
||||
'babel-plugin-antd-style',
|
||||
[
|
||||
'babel-plugin-styled-components',
|
||||
{
|
||||
displayName: !isProduction,
|
||||
minify: isProduction,
|
||||
pure: true,
|
||||
transpileTemplateLiterals: true,
|
||||
},
|
||||
],
|
||||
],
|
||||
},
|
||||
}),
|
||||
!isProduction && {
|
||||
|
|
|
|||
Loading…
Reference in New Issue