1 Star 0 Fork 1

ike_yu/mmf-blog-vite-vue3-ssr

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
vite.config.ts 2.07 KB
一键复制 编辑 原始数据 按行查看 历史
林岑影 提交于 2023-09-27 21:58 . feat: update eslint & format
import path from 'node:path'
import process from 'node:process'
import { fileURLToPath } from 'node:url'
import type { UserConfigExport } from 'vite'
import { defineConfig, loadEnv } from 'vite'
import vuePlugin from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import VueMacros from 'unplugin-vue-macros'
import { viteMockServe } from '@lincy/vite-plugin-mock'
import UnoCSS from 'unocss/vite'
import Components from './vite.config.components'
import PWA from './vite.config.pwa'
import Build from './vite.config.build'
function charsetRemoval() {
return {
postcssPlugin: 'internal:charset-removal',
AtRule: {
charset: (atRule: any) => {
if (atRule.name === 'charset')
atRule.remove()
},
},
}
}
// https://vitejs.dev/config/
export default defineConfig(({ mode, command }) => {
const __dirname = path.dirname(fileURLToPath(import.meta.url))
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) }
const localMock = true
const config: UserConfigExport = {
base: './',
plugins: [
VueMacros.vite({
plugins: {
vue: vuePlugin({
template: {
compilerOptions: {
isCustomElement: tag => ['def'].includes(tag),
},
},
}),
vueJsx: vueJsx(),
},
}),
viteMockServe({
mockPath: 'mock',
enable: command === 'serve' && localMock,
logger: true,
}),
...Components(),
UnoCSS({}),
...PWA(),
],
resolve: {
alias: {
'@': path.join(__dirname, './src'),
},
},
...Build,
css: {
postcss: {
plugins: [
charsetRemoval(),
],
},
},
}
return config
})
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ike_yu/mmf-blog-vite-vue3-ssr.git
[email protected]:ike_yu/mmf-blog-vite-vue3-ssr.git
ike_yu
mmf-blog-vite-vue3-ssr
mmf-blog-vite-vue3-ssr
master

搜索帮助