anything-llm/embedded-app/vite.config.js
timothycarambat 55170107c8 rough in modularization of embed chat
cleanup dev process for easier dev support
move all chat to components
todo: build process
todo: backend support
2024-01-31 13:34:25 -08:00

62 lines
1.4 KiB
JavaScript

// vite.config.js
import { defineConfig } from "vite"
import { fileURLToPath, URL } from "url"
import react from "@vitejs/plugin-react"
import image from "@rollup/plugin-image"
export default defineConfig({
plugins: [react(), image()],
define: {
// In dev, we need to disable this, but in prod, we need to enable it
"process.env.NODE_ENV": JSON.stringify("production")
},
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: {
lib: {
entry: "src/main.jsx",
name: "EmbeddedAnythingLLM",
formats: ["umd"],
fileName: (format) => `embedded-anything-llm.${format}.js`
},
rollupOptions: {
external: []
},
commonjsOptions: {
transformMixedEsModules: true
},
cssCodeSplit: false,
assetsInlineLimit: 100000000,
minify: "esbuild",
outDir: "dist",
emptyOutDir: true,
inlineDynamicImports: true,
assetsDir: "",
sourcemap: 'inline',
},
optimizeDeps: {
esbuildOptions: {
define: {
global: "globalThis"
},
plugins: []
}
},
})