fix
This commit is contained in:
180
vite.config.ts
180
vite.config.ts
@@ -5,100 +5,102 @@ import AutoImport from "unplugin-auto-import/vite"
|
|||||||
import { NaiveUiResolver } from "unplugin-vue-components/resolvers"
|
import { NaiveUiResolver } from "unplugin-vue-components/resolvers"
|
||||||
import Components from "unplugin-vue-components/vite"
|
import Components from "unplugin-vue-components/vite"
|
||||||
import Markdown from "unplugin-vue-markdown/vite"
|
import Markdown from "unplugin-vue-markdown/vite"
|
||||||
import { defineConfig } from "vite"
|
import { defineConfig, loadEnv } from "vite"
|
||||||
|
|
||||||
const url = process.env.VITE_OJ_URL
|
export default defineConfig(({ mode }) => {
|
||||||
|
const env = loadEnv(mode, process.cwd())
|
||||||
|
const url = env.VITE_OJ_URL
|
||||||
|
|
||||||
const proxyConfig = {
|
const proxyConfig = {
|
||||||
target: url,
|
target: url,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
headers: { Referer: url },
|
headers: { Referer: url },
|
||||||
}
|
}
|
||||||
|
return {
|
||||||
export default defineConfig({
|
build: {
|
||||||
build: {
|
rollupOptions: {
|
||||||
rollupOptions: {
|
output: {
|
||||||
output: {
|
manualChunks: {
|
||||||
manualChunks: {
|
chart: ["vue-chartjs", "chart.js"],
|
||||||
chart: ["vue-chartjs", "chart.js"],
|
editor: [
|
||||||
editor: [
|
"@wangeditor-next/editor",
|
||||||
"@wangeditor-next/editor",
|
"@wangeditor-next/editor-for-vue",
|
||||||
"@wangeditor-next/editor-for-vue",
|
],
|
||||||
],
|
cm: [
|
||||||
cm: [
|
"vue-codemirror",
|
||||||
"vue-codemirror",
|
"codemirror",
|
||||||
"codemirror",
|
"@codemirror/lang-cpp",
|
||||||
"@codemirror/lang-cpp",
|
"@codemirror/lang-python",
|
||||||
"@codemirror/lang-python",
|
],
|
||||||
],
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
resolve: {
|
||||||
resolve: {
|
alias: {
|
||||||
alias: {
|
"~": path.resolve(__dirname, "./src"),
|
||||||
"~": path.resolve(__dirname, "./src"),
|
utils: path.resolve(__dirname, "./src/utils"),
|
||||||
utils: path.resolve(__dirname, "./src/utils"),
|
oj: path.resolve(__dirname, "./src/oj"),
|
||||||
oj: path.resolve(__dirname, "./src/oj"),
|
admin: path.resolve(__dirname, "./src/admin"),
|
||||||
admin: path.resolve(__dirname, "./src/admin"),
|
learn: path.resolve(__dirname, "./src/learn"),
|
||||||
learn: path.resolve(__dirname, "./src/learn"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
Vue({ include: [/\.vue$/, /\.md$/] }),
|
|
||||||
AutoImport({
|
|
||||||
imports: [
|
|
||||||
"vue",
|
|
||||||
"vue-router",
|
|
||||||
"@vueuse/core",
|
|
||||||
"pinia",
|
|
||||||
{
|
|
||||||
"naive-ui": [
|
|
||||||
"useDialog",
|
|
||||||
"useMessage",
|
|
||||||
"useNotification",
|
|
||||||
"useLoadingBar",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
from: "naive-ui",
|
|
||||||
imports: [
|
|
||||||
"DataTableColumn",
|
|
||||||
"FormRules",
|
|
||||||
"FormItemRule",
|
|
||||||
"SelectOption",
|
|
||||||
"UploadCustomRequestOptions",
|
|
||||||
"UploadFileInfo",
|
|
||||||
"MenuOption",
|
|
||||||
"DropdownDividerOption",
|
|
||||||
"DropdownOption",
|
|
||||||
],
|
|
||||||
type: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
dts: "./src/auto-imports.d.ts",
|
|
||||||
}),
|
|
||||||
Components({
|
|
||||||
resolvers: [NaiveUiResolver()],
|
|
||||||
dts: "./src/components.d.ts",
|
|
||||||
}),
|
|
||||||
Markdown({
|
|
||||||
async markdownItSetup(md) {
|
|
||||||
md.use(
|
|
||||||
await Shiki({
|
|
||||||
themes: {
|
|
||||||
light: "vitesse-light",
|
|
||||||
dark: "vitesse-dark",
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
}),
|
|
||||||
],
|
|
||||||
server: {
|
|
||||||
proxy: {
|
|
||||||
"/api": proxyConfig,
|
|
||||||
"/public": proxyConfig,
|
|
||||||
},
|
},
|
||||||
},
|
plugins: [
|
||||||
|
Vue({ include: [/\.vue$/, /\.md$/] }),
|
||||||
|
AutoImport({
|
||||||
|
imports: [
|
||||||
|
"vue",
|
||||||
|
"vue-router",
|
||||||
|
"@vueuse/core",
|
||||||
|
"pinia",
|
||||||
|
{
|
||||||
|
"naive-ui": [
|
||||||
|
"useDialog",
|
||||||
|
"useMessage",
|
||||||
|
"useNotification",
|
||||||
|
"useLoadingBar",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: "naive-ui",
|
||||||
|
imports: [
|
||||||
|
"DataTableColumn",
|
||||||
|
"FormRules",
|
||||||
|
"FormItemRule",
|
||||||
|
"SelectOption",
|
||||||
|
"UploadCustomRequestOptions",
|
||||||
|
"UploadFileInfo",
|
||||||
|
"MenuOption",
|
||||||
|
"DropdownDividerOption",
|
||||||
|
"DropdownOption",
|
||||||
|
],
|
||||||
|
type: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
dts: "./src/auto-imports.d.ts",
|
||||||
|
}),
|
||||||
|
Components({
|
||||||
|
resolvers: [NaiveUiResolver()],
|
||||||
|
dts: "./src/components.d.ts",
|
||||||
|
}),
|
||||||
|
Markdown({
|
||||||
|
async markdownItSetup(md) {
|
||||||
|
md.use(
|
||||||
|
await Shiki({
|
||||||
|
themes: {
|
||||||
|
light: "vitesse-light",
|
||||||
|
dark: "vitesse-dark",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
server: {
|
||||||
|
proxy: {
|
||||||
|
"/api": proxyConfig,
|
||||||
|
"/public": proxyConfig,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user