chore: 初始化北汽福田看板前端项目
This commit is contained in:
48
vite.config.js
Normal file
48
vite.config.js
Normal file
@@ -0,0 +1,48 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import { fileURLToPath, URL } from "node:url";
|
||||
import copy from 'rollup-plugin-copy'
|
||||
import { resolve } from 'path'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
base: './',
|
||||
plugins: [
|
||||
vue()
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
||||
},
|
||||
},
|
||||
pluginOptions: {
|
||||
'style-resources-loader': {
|
||||
preProcessor: 'scss',
|
||||
patterns: []
|
||||
}
|
||||
},
|
||||
define: {
|
||||
'process.env': {}
|
||||
},
|
||||
// 完全禁用默认的 public 目录处理
|
||||
publicDir: false,
|
||||
build: {
|
||||
// 清空输出目录时保留自定义拷贝的文件
|
||||
emptyOutDir: true,
|
||||
|
||||
rollupOptions: {
|
||||
plugins: [
|
||||
copy({
|
||||
targets: [
|
||||
{
|
||||
src: 'public/**/*', // 复制整个 public 目录
|
||||
dest: 'dist/public' // 输出到 dist/public
|
||||
}
|
||||
],
|
||||
hook: 'writeBundle', // 在构建完成后执行
|
||||
copyOnce: true // 仅拷贝一次
|
||||
})
|
||||
]
|
||||
}
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user