Commit 4d77fcab authored by 蒋佳奇's avatar 蒋佳奇

feat: 静态资源托管

parent 4fe66735
......@@ -5,7 +5,8 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"prebuild": "yarn install --no-optional && cd server && yarn",
"build": "tsc -b && vite build --mode production",
"lint": "eslint .",
"preview": "vite preview"
},
......@@ -36,6 +37,7 @@
"typescript": "~5.7.2",
"unplugin-auto-import": "^19.1.2",
"vite": "^6.2.0",
"vite-plugin-assets-sync": "^0.0.4",
"vite-plugin-pages": "^0.32.5"
}
}
......@@ -2,12 +2,17 @@ import tailwindcss from '@tailwindcss/vite'
import react from '@vitejs/plugin-react-swc'
import AutoImport from 'unplugin-auto-import'
import { defineConfig } from 'vite'
import assetsSync from 'vite-plugin-assets-sync'
import Pages from 'vite-plugin-pages'
import { AutoImportError } from './vite-plugins/auto-import-error'
// TODO: 修改为静态资源托管路由
const PUBLIC_FOLDER = '<oss-base-path>'
// https://vite.dev/config/
export default defineConfig({
export default defineConfig(({ mode }) => ({
base: mode === 'production' ? `//yun.tuisnake.com/${PUBLIC_FOLDER}/` : '/',
server: {
proxy: {
'^/(.*)': {
......@@ -68,5 +73,8 @@ export default defineConfig({
},
}),
tailwindcss(),
assetsSync({
target: `/${PUBLIC_FOLDER}/assets/`,
}),
],
})
}))
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment