2023-05-02 15:22:46 +00:00
|
|
|
import { PluginOption, defineConfig } from 'vite'
|
2023-05-25 07:55:30 +00:00
|
|
|
import path from 'path'
|
2023-05-02 15:22:46 +00:00
|
|
|
import vue from '@vitejs/plugin-vue'
|
2023-05-02 09:44:23 +00:00
|
|
|
// 引入 Rollup Plugin Visualizer 打包可视化工具
|
2023-05-02 15:22:46 +00:00
|
|
|
import { visualizer } from 'rollup-plugin-visualizer'
|
2023-08-22 12:12:49 +00:00
|
|
|
// 导入 vite tsx 支持
|
|
|
|
import vueJsx from '@vitejs/plugin-vue-jsx'
|
2023-09-04 17:56:38 +00:00
|
|
|
// 导入 prismjs 高亮
|
|
|
|
import { prismjsPlugin } from 'vite-plugin-prismjs'
|
2023-04-14 13:58:13 +00:00
|
|
|
|
|
|
|
// https://vitejs.dev/config/
|
|
|
|
export default defineConfig({
|
2023-09-04 17:56:38 +00:00
|
|
|
plugins: [
|
|
|
|
vue(),
|
|
|
|
visualizer() as PluginOption,
|
|
|
|
vueJsx(),
|
|
|
|
prismjsPlugin({
|
2023-09-04 18:20:37 +00:00
|
|
|
// 这里和 wangEditor 适配
|
2023-09-04 17:56:38 +00:00
|
|
|
languages: [
|
2023-09-04 18:20:37 +00:00
|
|
|
'jsx',
|
|
|
|
'typescript',
|
2023-09-04 17:56:38 +00:00
|
|
|
'markup',
|
|
|
|
'go',
|
2023-09-04 18:20:37 +00:00
|
|
|
'php',
|
|
|
|
'c',
|
2023-09-04 17:56:38 +00:00
|
|
|
'python',
|
2023-09-04 18:20:37 +00:00
|
|
|
'java',
|
|
|
|
'cpp',
|
|
|
|
'csharp',
|
|
|
|
'visual-basic',
|
2023-09-04 17:56:38 +00:00
|
|
|
'sql',
|
2023-09-04 18:20:37 +00:00
|
|
|
'ruby',
|
|
|
|
'swift',
|
|
|
|
'bash',
|
2023-09-04 17:56:38 +00:00
|
|
|
'markdown',
|
2023-09-04 18:20:37 +00:00
|
|
|
'lua',
|
|
|
|
'groovy',
|
2023-09-04 17:56:38 +00:00
|
|
|
],
|
2023-09-04 18:20:37 +00:00
|
|
|
plugins: ['show-language', 'toolbar', 'copy-to-clipboard'],
|
2023-09-04 17:56:38 +00:00
|
|
|
theme: 'okaidia',
|
|
|
|
css: true,
|
|
|
|
}),
|
|
|
|
],
|
2023-04-20 08:04:08 +00:00
|
|
|
/* src 别名为 @ */
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
2023-05-02 15:22:46 +00:00
|
|
|
'@': path.resolve(__dirname, './src'),
|
2023-04-20 08:04:08 +00:00
|
|
|
},
|
|
|
|
},
|
2023-06-07 10:10:53 +00:00
|
|
|
// 消除 i18n 警告
|
|
|
|
define: {
|
|
|
|
__VUE_I18N_FULL_INSTALL__: true,
|
|
|
|
__VUE_I18N_LEGACY_API__: false,
|
|
|
|
__INTLIFY_PROD_DEVTOOLS__: false,
|
|
|
|
},
|
2023-05-02 15:22:46 +00:00
|
|
|
})
|