189
rated 0 times
[
191]
[
2]
/ answers: 1 / hits: 23822
/ 2 Years ago, fri, february 18, 2022, 12:00:00
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?
More From » reactjs