mirror of
https://github.com/acedanger/pokemon.git
synced 2025-12-05 22:50:13 -08:00
feat: add vite-plugin-node-polyfills to support Node.js globals in Vite
This commit is contained in:
@@ -1,7 +1,26 @@
|
||||
import { defineConfig } from "vite";
|
||||
// Import the new plugin
|
||||
import { nodePolyfills } from "vite-plugin-node-polyfills";
|
||||
|
||||
export default defineConfig({
|
||||
// Keep build target reasonable, 'modules' is often a good balance
|
||||
build: {
|
||||
target: "es2020", // Or try 'es2020' or 'modules' if 'esnext' doesn't work
|
||||
target: "modules",
|
||||
// Rollup options are not needed for this plugin
|
||||
},
|
||||
plugins: [
|
||||
// Add the plugin to Vite's plugins array
|
||||
nodePolyfills({
|
||||
// Options (optional):
|
||||
// - 'true'/'false' to include/exclude specific polyfills.
|
||||
// - 'build' to only include polyfills for the build.
|
||||
// - 'dev' to only include polyfills for the dev server.
|
||||
// By default, it polyfills globals like `Buffer` and `process`.
|
||||
// You might need to explicitly enable others if errors persist.
|
||||
// Example: globals: { Buffer: true, global: true, process: true },
|
||||
// Example: protocolImports: true, // If you need imports like 'node:fs'
|
||||
}),
|
||||
],
|
||||
// optimizeDeps and resolve.alias sections related to polyfills
|
||||
// are likely no longer needed with this plugin.
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user