Skip to content

Commit

Permalink
💩 Polyfill process with unenv
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Dec 10, 2024
1 parent 2ca37e2 commit 8c920e9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,17 @@ export default defineNuxtConfig({

plugins: ['~/plugins/buffer.ts'],

alias: {
// polyfill process
process: 'unenv/runtime/node/process'
},
vite: {
define: {
global: 'globalThis'
},
plugins: [
nodePolyfills({
// global breaks on dev
globals: {
process: false,
Buffer: false,
Expand Down
2 changes: 2 additions & 0 deletions plugins/buffer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Buffer } from 'buffer'
import process from 'node:process'

globalThis.Buffer = Buffer
globalThis.process = process

export default defineNuxtPlugin((_) => {
})

0 comments on commit 8c920e9

Please sign in to comment.