2023-06-04 04:28:07 +02:00
|
|
|
import { defineConfig } from 'vite'
|
2023-12-07 18:09:01 +01:00
|
|
|
import { fileURLToPath, URL } from "url";
|
2023-06-04 04:28:07 +02:00
|
|
|
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: [
|
2023-12-07 18:09:01 +01:00
|
|
|
{ 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(/^~/, "");
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
build: {
|
|
|
|
commonjsOptions: {
|
|
|
|
transformMixedEsModules: true,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
optimizeDeps: {
|
|
|
|
esbuildOptions: {
|
|
|
|
define: {
|
|
|
|
global: 'globalThis'
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|