代码拉取完成,页面将自动刷新
import path from "path";
import vue from "@vitejs/plugin-vue";
import { resolve } from "path";
import { defineConfig, loadEnv, UserConfig, UserConfigExport } from "vite";
import html from "vite-plugin-html";
import tsconfigPaths from "vite-tsconfig-paths";
import { createSvgIconsPlugin } from "vite-plugin-svg-icons";
import { mars3dPlugin } from "vite-plugin-mars3d";
import { createStyleImportPlugin,AndDesignVueResolve,} from "vite-plugin-style-import";
const prefix = `monaco-editor/esm/vs`;
export default (config: UserConfig): UserConfigExport => {
const mode = config.mode as string;
return defineConfig({
base: "./",
optimizeDeps: {
include: [
`${prefix}/language/json/json.worker`,
`${prefix}/language/css/css.worker`,
`${prefix}/language/html/html.worker`,
`${prefix}/language/typescript/ts.worker`,
`${prefix}/editor/editor.worker`,
"@jiaminghi/c-render",
"@jiaminghi/c-render/lib/plugin/util",
"@jiaminghi/charts/lib/util/index",
"@jiaminghi/charts/lib/util",
"@jiaminghi/charts/lib/extend/index",
"@jiaminghi/charts",
"@jiaminghi/color",
"@/../lib/vform/designer.umd.js"
]
},
css:{
preprocessorOptions: {
less: {
javascriptEnabled: true,
additionalData: `@import "${path.resolve(
__dirname,
"src/components/mars-ui/base.less"
)}";`,
},
},
},
plugins: [
vue(),
mars3dPlugin(),
html({
inject: {
injectData: {
apiURL: loadEnv(mode, process.cwd()).VITE_APP_API,
title: ""
}
},
minify: true
}),
tsconfigPaths(),
//#mars3d开始
createSvgIconsPlugin({
iconDirs: [resolve(__dirname, "src/assets/icons/svg")],
symbolId: "icon-[dir]-[name]"
}),
createStyleImportPlugin({
resolves: [AndDesignVueResolve()],
libs: [{
libraryName: "ant-design-vue",
esModule: true,
resolveStyle: (name) => {
if (name === "auto-complete") {
return `ant-design-vue/es/${name}/index`;
}
return `ant-design-vue/es/${name}/style/index`;
}
}]
}),
//#mars3d结束
],
build: {
chunkSizeWarningLimit: 1024,
commonjsOptions: {
include: /node_modules|lib/
},
rollupOptions: {
output: {
manualChunks: {
monacoeditor: ["monaco-editor"],
quill: ["quill"],
lodash: ["lodash"],
lib: ["sortablejs", "vxe-table", "xe-utils"],
vlib: ["vue", "vue-router", "vue-i18n", "element-plus"]
}
}
}
},
//#mars3d开始
define: {
"process.env": {
mode,
BASE_URL: loadEnv(mode, process.cwd()).VITE_BASE_URL,
API_BASE: loadEnv(mode, process.cwd()).VITE_API_URL,
API_LOCAL: loadEnv(mode, process.cwd()).VITE_LOCAL_API
},
buildTime: new Date()
},
//#mars3d结束
resolve: {
alias: {
// 配置别名
"@": resolve(__dirname, "./src"),
"vue-i18n": "vue-i18n/dist/vue-i18n.cjs.js"
}
},
server: {
open: true, // 自动启动浏览器
host: "0.0.0.0", // localhost
port: 8001, // 端口号
https: false,
proxy: {
"/prod-api": {
// target: "http://whkc.natapp1.cc:8080",
target: "http://1.92.105.211",
ws: true,
changeOrigin: true,
// rewrite: (path) => path.replace(/^\/api/, ''),
}
}
}
});
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。