feat: 添加路由拦截器/修复打包侧边栏图标失效问题
This commit is contained in:
@@ -2,26 +2,25 @@
|
||||
|
||||
import { defineConfig, loadEnv } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import * as path from "path";
|
||||
import { resolve } from "path";
|
||||
// icons plugin
|
||||
import { createSvgIconsPlugin } from "vite-plugin-svg-icons";
|
||||
import viteCompression from "vite-plugin-compression";
|
||||
import { createHtmlPlugin } from "vite-plugin-html";
|
||||
import legacy from "@vitejs/plugin-legacy";
|
||||
import postcssPresetEnv from "postcss-preset-env";
|
||||
import autoprefixer from "autoprefixer";
|
||||
import { nodePolyfills } from "vite-plugin-node-polyfills";
|
||||
import svgr from "vite-plugin-svgr";
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-expect-error
|
||||
//配置参数
|
||||
export default defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd());
|
||||
return {
|
||||
base: "./",
|
||||
base: "/",
|
||||
plugins: [
|
||||
react(),
|
||||
nodePolyfills(),
|
||||
svgr({ svgrOptions: { icon: true } }),
|
||||
legacy({
|
||||
targets: [
|
||||
"ie >= 11",
|
||||
@@ -56,13 +55,6 @@ export default defineConfig(({ mode }) => {
|
||||
],
|
||||
modernPolyfills: ["es.promise.all-settled", "es.object.entries"],
|
||||
}),
|
||||
// 修改 icons 相关配置
|
||||
createSvgIconsPlugin({
|
||||
// 指定需要缓存的图标文件夹
|
||||
iconDirs: [path.resolve(__dirname, "./src/assets/icons")],
|
||||
// 指定symbolId格式
|
||||
symbolId: "icon-[dir]-[name]",
|
||||
}),
|
||||
viteCompression({
|
||||
verbose: true, // 是否在控制台中输出压缩结果
|
||||
disable: false,
|
||||
@@ -127,7 +119,7 @@ export default defineConfig(({ mode }) => {
|
||||
},
|
||||
},
|
||||
esbuild: {
|
||||
// drop: ['console', 'debugger'],
|
||||
// drop: ["console", "debugger"],
|
||||
},
|
||||
build: {
|
||||
outDir: "dist", // 指定输出路径
|
||||
|
Reference in New Issue
Block a user