34 lines
873 B
JavaScript
34 lines
873 B
JavaScript
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import copy from "rollup-plugin-copy";
|
|
import path from 'path';
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
vue(),
|
|
copy({
|
|
targets: [
|
|
{ src: 'dist/index.html', dest: 'dist/src/html', rename: 'config.html' }
|
|
],
|
|
hook: 'writeBundle' // 指定在何时复制文件
|
|
})
|
|
],
|
|
build:{
|
|
rollupOptions:{
|
|
input:{
|
|
config:path.resolve(__dirname,'index.html'),
|
|
desktop:path.resolve(__dirname,'src/js/desktop.js'),
|
|
mobile:path.resolve(__dirname,'src/js/mobile.js'),
|
|
},
|
|
output:{
|
|
entryFileNames: (chunkInfo) => {
|
|
// console.log(chunkInfo);
|
|
return 'src/js/[name].js'; // 默认处理为 JS 文件
|
|
},
|
|
assetFileNames:'src/[ext]/[name].[ext]'
|
|
}
|
|
}
|
|
}
|
|
})
|