vite optimizeDeps
This commit is contained in:
@ -30,7 +30,7 @@
|
|||||||
"knip": "pnpm dlx knip"
|
"knip": "pnpm dlx knip"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"src/**/*.{js,ts,tsx,vue}": [
|
"src/**/*.{js,jsx,ts,tsx,vue}": [
|
||||||
"prettier --write",
|
"prettier --write",
|
||||||
"eslint --fix",
|
"eslint --fix",
|
||||||
"oxlint --fix"
|
"oxlint --fix"
|
||||||
|
@ -8,7 +8,7 @@ definePage({
|
|||||||
name: 'Home',
|
name: 'Home',
|
||||||
meta: {
|
meta: {
|
||||||
title: '首页',
|
title: '首页',
|
||||||
hidden: true,
|
hidden: false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -167,10 +167,9 @@ export function Plugins() {
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
// https://vite-plugin-checker.netlify.app/introduction/introduction.html
|
// https://vite-plugin-checker.netlify.app/introduction/introduction.html
|
||||||
// XXX: 配置更多的检查项
|
|
||||||
checker({
|
checker({
|
||||||
eslint: {
|
eslint: {
|
||||||
lintCommand: 'eslint ./src',
|
lintCommand: 'eslint "./src/**/*.{js,jsx,ts,tsx,vue}"',
|
||||||
useFlatConfig: true,
|
useFlatConfig: true,
|
||||||
},
|
},
|
||||||
vueTsc: true,
|
vueTsc: true,
|
||||||
@ -179,6 +178,7 @@ export function Plugins() {
|
|||||||
},
|
},
|
||||||
terminal: true,
|
terminal: true,
|
||||||
enableBuild: true,
|
enableBuild: true,
|
||||||
|
// XXX: pnpm add vls vti -D
|
||||||
}),
|
}),
|
||||||
|
|
||||||
viteStaticCopy({
|
viteStaticCopy({
|
||||||
|
@ -6,12 +6,34 @@ import { defineConfig, loadEnv } from 'vite';
|
|||||||
|
|
||||||
import { cesiumBaseUrl, Plugins } from './vite.config.plugins';
|
import { cesiumBaseUrl, Plugins } from './vite.config.plugins';
|
||||||
|
|
||||||
|
const primevuecomponents = await (async () => {
|
||||||
|
const { components } = await import('@primevue/metadata');
|
||||||
|
return components.map((c) => c.from).filter((c) => c !== undefined);
|
||||||
|
})();
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig(({ command, mode }) => {
|
export default defineConfig(({ command, mode }) => {
|
||||||
const isBuild = command === 'build';
|
const isBuild = command === 'build';
|
||||||
const env = loadEnv(mode, process.cwd());
|
const env = loadEnv(mode, process.cwd());
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
// https://cn.vite.dev/config/dep-optimization-options
|
||||||
|
// ???
|
||||||
|
optimizeDeps: {
|
||||||
|
include: [
|
||||||
|
...primevuecomponents,
|
||||||
|
'@primeuix/themes',
|
||||||
|
'@primeuix/themes/lara',
|
||||||
|
'class-variance-authority',
|
||||||
|
'clsx',
|
||||||
|
'tailwind-merge',
|
||||||
|
'reka-ui',
|
||||||
|
'axios',
|
||||||
|
'@ant-design/icons-vue',
|
||||||
|
'ant-design-vue/es',
|
||||||
|
],
|
||||||
|
exclude: ['quill', 'chart.js/auto'],
|
||||||
|
},
|
||||||
base: env.VITE_BASE,
|
base: env.VITE_BASE,
|
||||||
build: {
|
build: {
|
||||||
minify: 'terser',
|
minify: 'terser',
|
||||||
|
Reference in New Issue
Block a user