mirror of
https://github.com/wikihost-opensource/als.git
synced 2025-12-24 12:57:59 +08:00
fix: 修复 Docke build 不处理软链接的问题
This commit is contained in:
@@ -5,9 +5,11 @@ import vue from '@vitejs/plugin-vue'
|
||||
import AutoImport from 'unplugin-auto-import/vite'
|
||||
import Components from 'unplugin-vue-components/vite'
|
||||
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'
|
||||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig((e) => {
|
||||
export default defineConfig(({ command }) => {
|
||||
return {
|
||||
server: {
|
||||
proxy: {
|
||||
@@ -36,6 +38,25 @@ export default defineConfig((e) => {
|
||||
}
|
||||
]
|
||||
}),
|
||||
{
|
||||
name: 'build-script',
|
||||
buildStart(options) {
|
||||
if (command === 'build') {
|
||||
const dirPath = path.join(__dirname, 'public');
|
||||
const fileBuildRequired = {
|
||||
"speedtest_worker.js": "../speedtest/speedtest_worker.js"
|
||||
};
|
||||
|
||||
for (var dest in fileBuildRequired) {
|
||||
const source = fileBuildRequired[dest]
|
||||
if (fs.existsSync(dirPath + "/" + dest)) {
|
||||
fs.unlinkSync(dirPath + "/" + dest)
|
||||
}
|
||||
fs.copyFileSync(dirPath + "/" + source, dirPath + "/" + dest)
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
Components({
|
||||
resolvers: [NaiveUiResolver()]
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user