By default Vite generates files in the source directory under dist.
my-app/
├─ node_modules/
├─ dist/
│ ├─ assets/
| | | index.js
| | | index.css
│ ├─ index.html
├─ index.html
├─ main.js
├─ style.scss
├─ package.json
I need to create a different folder for js and css files under assets. In other words, I need to put js and css filer under /assets/js and /assets/css folders respectively.
my-app/
├─ node_modules/
├─ dist/
│ ├─ assets/
| | |-js/
| | | index.js
| | |-css/
| | | index.css
This is my config file.
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import svgrPlugin from "vite-plugin-svgr";
// https://vitejs.dev/config/
export default defineConfig({
base: "./",
plugins: [react(), svgrPlugin()],
server: {
open: true,
proxy: {
"/base": {
target: "http://localhost:19000",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/base/, ""),
},
},
},
});
How to do so?