加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
vite.config.js 1.36 KB
一键复制 编辑 原始数据 按行查看 历史
lidonghui 提交于 2024-09-21 20:50 . code up
/*
* @Date: 2022-10-25 19:36:56
* * @LastEditors: LDH 574427343@qq.com
* @LastEditTime: 2023-03-15 11:20:45
* @FilePath: /ant-flow/vite.config.js
*/
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from "path";
// https://vitejs.dev/config/
export default defineConfig(({mode})=>{
console.log(mode);
return {
resolve: {
alias: {
'@': path.resolve(__dirname, "src"),
'~@': path.resolve(__dirname, "src"),
}
},
css: {
preprocessorOptions: {
less: {
modifyVars: {},
javascriptEnabled: true
},
scss: {
additionalData: `@import "src/styles/global.scss";`
}
}
},
base: mode === "production" ? '/ant-flow/dist/' : '/',///ant-flow/dist/
plugins: [
vue(),
AutoImport({
resolvers: [ElementPlusResolver()],
}),
Components({
resolvers: [ElementPlusResolver()],
}),
],
build: {
/** If you set esmExternals to true, this plugins assumes that
all external dependencies are ES modules */
commonjsOptions: {
esmExternals: true
},
}
}
})
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化