10 Star 108 Fork 39

每天一点 / antv x6 demo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
vite.config.ts 1.77 KB
一键复制 编辑 原始数据 按行查看 历史
每天一点 提交于 2022-10-17 00:55 . 升级
import { UserConfig, ConfigEnv } from 'vite';
import { createVitePlugins } from './build/vite/plugins';
import { resolve } from 'path';
import proxy from './build/vite/proxy';
import { VITE_PORT } from './build/constant';
function pathResolve(dir: string) {
return resolve(process.cwd(), '.', dir);
}
// https://vitejs.dev/config/
export default ({ command }: ConfigEnv): UserConfig => {
const isBuild = command === 'build';
let base: string;
if (command === 'build') {
base = '/fast-vue3/';
} else {
base = '/';
}
return {
base,
resolve: {
alias: [
{
find: '@antv/x6',
replacement: '@antv/x6/dist/x6.js',
},
{
find: '@antv/x6-vue-shape',
replacement: '@antv/x6-vue-shape/lib',
},
{
find: 'vue-i18n',
replacement: 'vue-i18n/dist/vue-i18n.cjs.js',
},
// /@/xxxx => src/xxxx
{
find: /\/@\//,
replacement: pathResolve('src') + '/',
},
// /#/xxxx => types/xxxx
{
find: /\/#\//,
replacement: pathResolve('types') + '/',
},
],
},
// plugins
plugins: createVitePlugins(isBuild),
// css
css: {},
// server
server: {
hmr: { overlay: false }, // 禁用或配置 HMR 连接 设置 server.hmr.overlay 为 false 可以禁用服务器错误遮罩层
// 服务配置
port: VITE_PORT, // 类型: number 指定服务器端口;
open: false, // 类型: boolean | string在服务器启动时自动在浏览器中打开应用程序;
cors: false, // 类型: boolean | CorsOptions 为开发服务器配置 CORS。默认启用并允许任何源
host: '0.0.0.0', // IP配置,支持从IP启动
proxy,
},
};
};
TypeScript
1
https://gitee.com/icefox1/cx-flow-x6.git
git@gitee.com:icefox1/cx-flow-x6.git
icefox1
cx-flow-x6
antv x6 demo
master

搜索帮助