Newer
Older
import { nodePolyfills } from "vite-plugin-node-polyfills";
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
nodePolyfills({
// To add only specific polyfills, add them here. If no option is passed, adds all polyfills
include: ["buffer", "util", "stream", "process"],
// To exclude specific polyfills, add them to this list. Note: if include is provided, this has no effect
exclude: [
"http", // Excludes the polyfill for `http` and `node:http`.
],
// Whether to polyfill specific globals.
globals: {
buffer: true,
process: true,
},
}),
],
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
},
optimizeDeps: {
esbuildOptions: {
// Node.js global to browser globalThis
define: {
global: "globalThis",
},