anything-llm/frontend/vite.config.js

64 lines
1.3 KiB
JavaScript
Raw Permalink Normal View History

import { defineConfig } from "vite"
import { fileURLToPath, URL } from "url"
import postcss from "./postcss.config.js"
import react from "@vitejs/plugin-react"
import dns from "dns"
import { visualizer } from "rollup-plugin-visualizer"
2023-06-04 04:28:07 +02:00
dns.setDefaultResultOrder("verbatim")
2023-06-04 04:28:07 +02:00
// https://vitejs.dev/config/
export default defineConfig({
server: {
port: 3000,
host: "localhost"
2023-06-04 04:28:07 +02:00
},
define: {
"process.env": process.env
2023-06-04 04:28:07 +02:00
},
css: {
postcss
2023-06-04 04:28:07 +02:00
},
plugins: [
react(),
visualizer({
template: "treemap", // or sunburst
open: false,
gzipSize: true,
brotliSize: true,
filename: "bundleinspector.html" // will be saved in project's root
})
2023-06-04 04:28:07 +02:00
],
resolve: {
alias: [
{
find: "@",
replacement: fileURLToPath(new URL("./src", import.meta.url))
},
2023-06-04 04:28:07 +02:00
{
process: "process/browser",
stream: "stream-browserify",
zlib: "browserify-zlib",
util: "util",
find: /^~.+/,
replacement: (val) => {
return val.replace(/^~/, "")
}
}
]
2023-06-04 04:28:07 +02:00
},
build: {
commonjsOptions: {
transformMixedEsModules: true
2023-06-04 04:28:07 +02:00
}
},
optimizeDeps: {
esbuildOptions: {
define: {
global: "globalThis"
2023-06-04 04:28:07 +02:00
},
plugins: []
2023-06-04 04:28:07 +02:00
}
}
})