29 lines
690 B
JavaScript
29 lines
690 B
JavaScript
import { defineConfig } from 'vite';
|
|
import { cpSync, existsSync } from 'node:fs';
|
|
import { resolve } from 'node:path';
|
|
|
|
function copyVendorAssets() {
|
|
return {
|
|
name: 'copy-vendor-assets',
|
|
closeBundle() {
|
|
const root = process.cwd();
|
|
const sourceDir = resolve(root, 'vendor');
|
|
const targetDir = resolve(root, 'dist/vendor');
|
|
if (existsSync(sourceDir)) {
|
|
cpSync(sourceDir, targetDir, { recursive: true });
|
|
}
|
|
},
|
|
};
|
|
}
|
|
|
|
export default defineConfig({
|
|
base: './',
|
|
plugins: [copyVendorAssets()],
|
|
server: {
|
|
host: true,
|
|
},
|
|
preview: {
|
|
host: true,
|
|
},
|
|
});
|