加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
vite.config.ts 1.91 KB
一键复制 编辑 原始数据 按行查看 历史
vir 提交于 2022-05-11 10:40 . chore(图标): :sparkles:支持导入 svg 文件
import { defineConfig } from 'vite';
import { resolve } from 'path';
import { VitePWA } from 'vite-plugin-pwa';
import mdx from 'vite-plugin-mdx';
import { visualizer } from 'rollup-plugin-visualizer';
import react from '@vitejs/plugin-react';
import vitePluginImp from 'vite-plugin-imp';
import viteSentry from 'vite-plugin-sentry';
import packageData from './package.json';
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
import path from 'path';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react(),
VitePWA({}),
mdx(),
// build 分析
visualizer(),
vitePluginImp({
libList: [
{
libName: 'antd',
style: (name) => `antd/es/${name}/style/index.less`,
},
],
}),
viteSentry({
authToken: process.env?.SENTRY_TOKEN,
org: process.env?.SENTRY_ORG,
project: process.env?.SENTRY_PROJECT,
release: packageData.version,
deploy: {
env: 'production',
},
setCommits: {
auto: true,
},
sourceMaps: {
include: ['./dist/assets'],
ignore: ['node_modules'],
urlPrefix: '~/assets',
},
}),
createSvgIconsPlugin({
iconDirs: [
path.resolve(process.cwd(), 'node_modules/qweather-icons/icons'),
],
symbolId: 'icon-[name]',
}),
],
css: {
preprocessorOptions: {
less: {
javascriptEnabled: true,
},
},
},
server: {
host: '0.0.0.0',
port: 8100,
strictPort: true,
open: false,
proxy: {
'/v1': {
target: 'https://api.search.virs.xyz/',
changeOrigin: true,
},
},
},
resolve: {
alias: {
'@': resolve(__dirname, 'src'),
'@pages': resolve(__dirname, 'src/pages'),
'@views': resolve(__dirname, 'src/views'),
},
extensions: ['.js', '.jsx', '.json', '.ts', '.tsx'],
},
build: {
sourcemap: true,
},
});
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化