代码拉取完成,页面将自动刷新
同步操作将从 zym/vue-pure-admin 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import { resolve } from "path";
import { UserConfigExport, ConfigEnv } from "vite";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
import { loadEnv } from "./build/utils";
import { createProxy } from "./build/proxy";
import { viteMockServe } from "vite-plugin-mock";
import svgLoader from "vite-svg-loader";
import styleImport from "vite-plugin-style-import";
import VitePluginElementPlus from "vite-plugin-element-plus";
const pathResolve = (dir: string): any => {
return resolve(__dirname, ".", dir);
};
const { VITE_PORT, VITE_PUBLIC_PATH, VITE_PROXY } = loadEnv();
const alias: Record<string, string> = {
"/@": pathResolve("src"),
//解决开发环境下的警告 You are running the esm-bundler build of vue-i18n. It is recommended to configure your bundler to explicitly replace feature flag globals with boolean literals to get proper tree-shaking in the final bundle.
"vue-i18n": "vue-i18n/dist/vue-i18n.cjs.js"
};
const root: string = process.cwd();
export default ({ command }: ConfigEnv): UserConfigExport => {
const prodMock = true;
return {
/**
* 基本公共路径
* /manages/ 可根据项目部署域名的后缀自行填写(全局搜/manages/替换)
* @default '/'
*/
base:
process.env.NODE_ENV === "production" ? "/manages/" : VITE_PUBLIC_PATH,
root,
resolve: {
alias
},
// 服务端渲染
server: {
// 是否开启 https
https: false,
/**
* 端口号
* @default 3000
*/
port: VITE_PORT,
host: "0.0.0.0",
// 本地跨域代理
proxy: createProxy(VITE_PROXY)
},
plugins: [
vue(),
vueJsx(),
svgLoader(),
styleImport({
libs: [
// 按需加载vxe-table
{
libraryName: "vxe-table",
esModule: true,
resolveComponent: name => `vxe-table/es/${name}`,
resolveStyle: name => `vxe-table/es/${name}/style.css`
}
]
}),
VitePluginElementPlus({ useSource: true }),
viteMockServe({
mockPath: "mock",
localEnabled: command === "serve",
prodEnabled: command !== "serve" && prodMock,
injectCode: `
import { setupProdMockServer } from './mockProdServer';
setupProdMockServer();
`,
logger: true
})
],
optimizeDeps: {
include: [
"element-plus/lib/locale/lang/zh-cn",
"element-plus/lib/locale/lang/en",
"vxe-table/lib/locale/lang/zh-CN",
"vxe-table/lib/locale/lang/en-US"
]
},
build: {
// @ts-ignore
sourcemap: false,
brotliSize: false,
// 消除打包大小超过500kb警告
chunkSizeWarningLimit: 2000
},
define: {
__INTLIFY_PROD_DEVTOOLS__: false
}
};
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。