@deron
To copy a static folder to both "dev" and "build" directories in Vite, you can use the copy plugin provided by Vite. Here's how you can achieve this:
1
|
npm install vite-plugin-copy --save-dev |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
import { defineConfig } from 'vite';
import copy from 'vite-plugin-copy';
export default defineConfig({
plugins: [
copy({
targets: [
{ src: 'static', dest: 'dev' }, // copy the static folder to the dev directory
{ src: 'static', dest: 'build' }, // copy the static folder to the build directory
],
verbose: true, // optional, for verbose output
}),
],
});
|
By following these steps, you can easily copy a static folder to both "dev" and "build" directories in Vite using the copy plugin.