代码拉取完成,页面将自动刷新
同步操作将从 星星在线/OpenDataV 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import type { UserConfigExport, ConfigEnv, ProxyOptions } from 'vite'
import { loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import MarkDownPlugin from 'vite-plugin-vue-markdown'
import { viteMockServe } from 'vite-plugin-mock'
import vueJsx from '@vitejs/plugin-vue-jsx'
import { resolve } from 'path'
// https://vitejs.dev/config/
export default ({ mode, command }: ConfigEnv): UserConfigExport => {
const { VITE_APP_PORT, VITE_APP_PROXY, VITE_MOCK } = loadEnv(mode, process.cwd())
const createProxy = (propxyList) => {
const ret = {} as Record<string, ProxyOptions>
for (const [prefix, target] of propxyList) {
ret[prefix] = {
target: target,
changeOrigin: true,
rewrite: (path) => path.replace(new RegExp(`^${prefix}`), '')
}
}
return ret
}
return {
plugins: [
vue({
include: [/\.vue$/, /\.md$/] // <--
}),
vueJsx(),
viteMockServe({
mockPath: 'mock',
supportTs: true, //如果使用 js发开,则需要配置 supportTs 为 false
logger: true,
localEnabled: command === 'serve',
prodEnabled: VITE_MOCK === 'true',
injectCode: `
import { setupProdMockServer } from '../mock/mockProdServer';
setupProdMockServer();
`
}),
MarkDownPlugin({
markdownItSetup(md) {
md.use(require('./build/toc.js'))
}
})
],
base: './',
resolve: {
alias: {
// 路径别名
'@': resolve(__dirname, 'src')
},
// 使用路径别名时想要省略的后缀名,官方不建议将.vue文件省略后缀
extensions: ['.js', '.ts']
},
server: {
// 是否开启 https
https: false,
port: Number(VITE_APP_PORT),
host: '0.0.0.0',
open: false,
proxy: createProxy(JSON.parse(VITE_APP_PROXY)),
fs: {
allow: ['..'],
strict: false
},
cors: true
},
build: {
target: 'es2015',
chunkSizeWarningLimit: 1500,
terserOptions: {
compress: {
keep_infinity: true,
// Used to delete console in production environment
drop_console: true
}
}
},
css: {
preprocessorOptions: {
less: {
modifyVars: {
hack: `true; @import (reference) "${resolve('src/css/index.less')}";`
},
javascriptEnabled: true
}
},
modules: {
localsConvention: 'camelCase'
}
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。