mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-15 02:50:10 +01:00
8180787c2e
* Enable editing and setting of meta-tag information * cleanup * tmp build for testing * finally always refresh * unset workflow * dev build * rm tmp build
79 lines
1.9 KiB
JavaScript
79 lines
1.9 KiB
JavaScript
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"
|
|
|
|
dns.setDefaultResultOrder("verbatim")
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
server: {
|
|
port: 3000,
|
|
host: "localhost"
|
|
},
|
|
define: {
|
|
"process.env": process.env
|
|
},
|
|
css: {
|
|
postcss
|
|
},
|
|
plugins: [
|
|
react(),
|
|
visualizer({
|
|
template: "treemap", // or sunburst
|
|
open: false,
|
|
gzipSize: true,
|
|
brotliSize: true,
|
|
filename: "bundleinspector.html" // will be saved in project's root
|
|
})
|
|
],
|
|
resolve: {
|
|
alias: [
|
|
{
|
|
find: "@",
|
|
replacement: fileURLToPath(new URL("./src", import.meta.url))
|
|
},
|
|
{
|
|
process: "process/browser",
|
|
stream: "stream-browserify",
|
|
zlib: "browserify-zlib",
|
|
util: "util",
|
|
find: /^~.+/,
|
|
replacement: (val) => {
|
|
return val.replace(/^~/, "")
|
|
}
|
|
}
|
|
]
|
|
},
|
|
build: {
|
|
rollupOptions: {
|
|
output: {
|
|
// These settings ensure the primary JS and CSS file references are always index.{js,css}
|
|
// so we can SSR the index.html as text response from server/index.js without breaking references each build.
|
|
entryFileNames: 'index.js',
|
|
assetFileNames: (assetInfo) => {
|
|
if (assetInfo.name === 'index.css') return `index.css`;
|
|
return assetInfo.name;
|
|
},
|
|
},
|
|
external: [
|
|
// Reduces transformation time by 50% and we don't even use this variant, so we can ignore.
|
|
/@phosphor-icons\/react\/dist\/ssr/
|
|
]
|
|
},
|
|
commonjsOptions: {
|
|
transformMixedEsModules: true
|
|
}
|
|
},
|
|
optimizeDeps: {
|
|
esbuildOptions: {
|
|
define: {
|
|
global: "globalThis"
|
|
},
|
|
plugins: []
|
|
}
|
|
}
|
|
})
|