Last active
December 26, 2022 09:32
-
-
Save sadiqsalau/872a12a0d44882f9e492290270c57e21 to your computer and use it in GitHub Desktop.
Vite Polyfills
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"compilerOptions": { | |
"composite": true, | |
"module": "ESNext", | |
"moduleResolution": "Node", | |
"allowSyntheticDefaultImports": true | |
}, | |
"include": ["vite.config.polyfills.ts", "vite.config.ts"] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { defineConfig } from 'vite' | |
import polyfills from "./vite.config.polyfills" | |
// https://vitejs.dev/config/ | |
export default defineConfig({ | |
...polyfills | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* pnpm add -D esbuild-plugins-node-modules-polyfill rollup-plugin-polyfill-node | |
*/ | |
import nodePolyfills from "rollup-plugin-polyfill-node"; | |
import { defineConfig } from "vite"; | |
import { nodeModulesPolyfillPlugin } from "esbuild-plugins-node-modules-polyfill"; | |
export default defineConfig({ | |
optimizeDeps: { | |
esbuildOptions: { | |
// Enable esbuild polyfill plugins | |
plugins: [nodeModulesPolyfillPlugin()], | |
}, | |
}, | |
build: { | |
rollupOptions: { | |
plugins: [nodePolyfills()], | |
}, | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment