1 Star 0 Fork 0

lzq_warehouse/data-warehouse-fronted

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
vite.config.ts 5.25 KB
一键复制 编辑 原始数据 按行查看 历史
刘志强 提交于 2022-01-24 13:26 . 多环境
import path from 'path'
import { defineConfig } from 'vite'
import Vue from '@vitejs/plugin-vue'
import Pages from 'vite-plugin-pages'
import Layouts from 'vite-plugin-vue-layouts'
import Icons from 'unplugin-icons/vite'
import IconsResolver from 'unplugin-icons/resolver'
import Components from 'unplugin-vue-components/vite'
import AutoImport from 'unplugin-auto-import/vite'
import Markdown from 'vite-plugin-md'
import WindiCSS from 'vite-plugin-windicss'
import { VitePWA } from 'vite-plugin-pwa'
import VueI18n from '@intlify/vite-plugin-vue-i18n'
import Inspect from 'vite-plugin-inspect'
import Prism from 'markdown-it-prism'
import LinkAttributes from 'markdown-it-link-attributes'
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
const markdownWrapperClasses = 'prose prose-sm m-auto text-left'
// @ts-ignore
export default defineConfig({
resolve: {
alias: {
'~/': `${path.resolve(__dirname, 'src')}/`,
},
},
plugins: [
Vue({
include: [/\.vue$/, /\.md$/],
}),
// https://github.com/hannoeru/vite-plugin-pages
Pages({
extensions: ['vue', 'md'],
}),
// https://github.com/JohnCampionJr/vite-plugin-vue-layouts
Layouts(),
// https://github.com/antfu/unplugin-auto-import
AutoImport({
imports: [
'vue',
'vue-router',
'vue-i18n',
'@vueuse/head',
'@vueuse/core',
'vitest',
],
dts: 'src/auto-imports.d.ts'
}),
// https://github.com/antfu/unplugin-vue-components
Components({
// allow auto load markdown components under `./src/components/`
extensions: ['vue', 'md'],
// allow auto import and register components used in markdown
include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
// custom resolvers
resolvers: [
ElementPlusResolver({
importStyle: "sass",
}),
// auto import icons
// https://github.com/antfu/unplugin-icons
IconsResolver({
componentPrefix: '',
// enabledCollections: ['carbon']
}),
],
dts: 'src/components.d.ts',
}),
// https://github.com/antfu/unplugin-icons
Icons({
autoInstall: true,
}),
// https://github.com/antfu/vite-plugin-windicss
WindiCSS({
safelist: markdownWrapperClasses,
}),
// https://github.com/antfu/vite-plugin-md
// Don't need this? Try vitesse-lite: https://github.com/antfu/vitesse-lite
Markdown({
wrapperClasses: markdownWrapperClasses,
headEnabled: true,
markdownItSetup(md) {
// https://prismjs.com/
// @ts-expect-error types mismatch
md.use(Prism)
// @ts-expect-error types mismatch
md.use(LinkAttributes, {
pattern: /^https?:\/\//,
attrs: {
target: '_blank',
rel: 'noopener',
},
})
},
}),
// https://github.com/antfu/vite-plugin-pwa
VitePWA({
registerType: 'autoUpdate',
includeAssets: ['favicon.svg', 'robots.txt', 'safari-pinned-tab.svg'],
manifest: {
name: 'Vitesse',
short_name: 'Vitesse',
theme_color: '#ffffff',
icons: [
{
src: '/pwa-192x192.png',
sizes: '192x192',
type: 'image/png',
},
{
src: '/pwa-512x512.png',
sizes: '512x512',
type: 'image/png',
},
{
src: '/pwa-512x512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'any maskable',
},
],
},
}),
// https://github.com/intlify/bundle-tools/tree/main/packages/vite-plugin-vue-i18n
VueI18n({
runtimeOnly: true,
compositionOnly: true,
include: [path.resolve(__dirname, 'locales/**')],
}),
// https://github.com/antfu/vite-plugin-inspect
Inspect({
// change this to enable inspect for debugging
enabled: false,
}),
],
server: {
fs: {
strict: true,
},
hmr:{
overlay: false,
},
port: 3000,
open: true, //自动打开
proxy: { // 本地开发环境通过代理实现跨域,生产环境使用 nginx 转发
// 正则表达式写法
'^/dev': {
target: 'http://172.16.190.63:8080', // 后端服务实际地址
changeOrigin: true, //开启代理
rewrite: (path) => {
return path.replace(/^\/dev/, '/')
}
},
'^/test': {
target: 'http://172.16.190.63:9000', // 后端服务实际地址
changeOrigin: true, //开启代理
rewrite: (path) => path.replace(/^\/test/, '/')
},
'^/pro': {
target: 'http://172.16.190.63:10000', // 后端服务实际地址
changeOrigin: true, //开启代理
rewrite: (path) => path.replace(/^\/pro/, '/')
}
}
},
// https://github.com/antfu/vite-ssg
ssgOptions: {
script: 'async',
formatting: 'minify',
},
optimizeDeps: {
include: [
'vue',
'vue-router',
'@vueuse/core',
'@vueuse/head',
],
exclude: [
'vue-demi',
],
},
// https://github.com/vitest-dev/vitest
test: {
include: ['test/**/*.test.ts'],
environment: 'jsdom',
deps: {
inline: ['@vue', '@vueuse', 'vue-demi'],
},
},
})
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lzq_warehouse/data-warehouse-fronted.git
[email protected]:lzq_warehouse/data-warehouse-fronted.git
lzq_warehouse
data-warehouse-fronted
data-warehouse-fronted
main

搜索帮助