69 lines
1.7 KiB
TypeScript
69 lines
1.7 KiB
TypeScript
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
|
||
import { fileURLToPath, URL } from 'node:url'
|
||
import vueSetupExtend from 'unplugin-vue-setup-extend-plus/vite'
|
||
// @ts-expect-error fix type-check
|
||
import veauryVitePlugins from 'veaury/vite'
|
||
import { defineConfig } from 'vite'
|
||
import { vitePluginFakeServer } from 'vite-plugin-fake-server'
|
||
import vueDevTools from 'vite-plugin-vue-devtools'
|
||
|
||
import MonacoEditorNlsPlugin, {
|
||
esbuildPluginMonacoEditorNls,
|
||
Languages,
|
||
} from './src/utils/monaco/vite/nls'
|
||
|
||
// https://vitejs.dev/config/
|
||
export default defineConfig(() => {
|
||
return {
|
||
css: {
|
||
preprocessorOptions: {
|
||
less: {
|
||
javascriptEnabled: true,
|
||
},
|
||
},
|
||
},
|
||
plugins: [
|
||
// 关闭 vue 和 vuejsx 插件
|
||
// vue(),
|
||
// vueJsx(),
|
||
// type设为vue时, 所有名为react_app目录中的文件的jsx将被react jsx编译,其他文件里的jsx将以vue jsx编译
|
||
veauryVitePlugins({
|
||
type: 'vue',
|
||
}),
|
||
vueDevTools(),
|
||
// mock支持
|
||
vitePluginFakeServer({
|
||
logger: false,
|
||
include: 'mock',
|
||
infixName: false,
|
||
enableProd: true,
|
||
basename: '/mock',
|
||
}),
|
||
vueSetupExtend({ mode: 'relativeName' }),
|
||
VueI18nPlugin({}),
|
||
MonacoEditorNlsPlugin({
|
||
locale: Languages.zh_hans,
|
||
}),
|
||
],
|
||
optimizeDeps: {
|
||
/** vite >= 2.3.0 */
|
||
esbuildOptions: {
|
||
plugins: [
|
||
esbuildPluginMonacoEditorNls({
|
||
locale: Languages.zh_hans,
|
||
}),
|
||
],
|
||
},
|
||
},
|
||
resolve: {
|
||
alias: {
|
||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||
},
|
||
},
|
||
server: {
|
||
host: true,
|
||
port: 10000,
|
||
},
|
||
}
|
||
})
|