Skip to content
Snippets Groups Projects
vite.config.ts 1.01 KiB
Newer Older
  • Learn to ignore specific revisions
  • Daniel Göbel's avatar
    Daniel Göbel committed
    import { fileURLToPath, URL } from "node:url";
    
    import { nodePolyfills } from "vite-plugin-node-polyfills";
    
    Daniel Göbel's avatar
    Daniel Göbel committed
    
    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,
          },
        }),
      ],
    
    Daniel Göbel's avatar
    Daniel Göbel committed
      resolve: {
        alias: {
          "@": fileURLToPath(new URL("./src", import.meta.url)),
    
        },
      },
      optimizeDeps: {
        esbuildOptions: {
          // Node.js global to browser globalThis
          define: {
            global: "globalThis",
          },
    
    Daniel Göbel's avatar
    Daniel Göbel committed
        },
      },
    });