Danny Vogel
Danny Vogel
NNuxt
Created by Danny Vogel on 10/24/2024 in #❓・help
Missing environmental variable causing infinite errors
No description
9 replies
NNuxt
Created by Danny Vogel on 10/1/2024 in #❓・help
Issue: Initial page load flash before hydration
No description
16 replies
NNuxt
Created by Danny Vogel on 8/1/2024 in #❓・help
Node polyfills
Hi, little optimization question: One of the libraries I use requires Node polyfilling, so I currently do the following in my nuxtConfig:
vite: {
plugins: [
nodePolyfills({
include: ["buffer", "process"],
globals: {
Buffer: true,
global: true,
process: true,
},
protocolImports: false,
}),
],
},
vite: {
plugins: [
nodePolyfills({
include: ["buffer", "process"],
globals: {
Buffer: true,
global: true,
process: true,
},
protocolImports: false,
}),
],
},
Given that Nuxt v3.10 provides client-side Node.js support, can I use
import { Buffer } from 'node:buffer'
import process from 'node:process'

globalThis.Buffer = Buffer
globalThis.process = process
import { Buffer } from 'node:buffer'
import process from 'node:process'

globalThis.Buffer = Buffer
globalThis.process = process
somehow and avoid using the vite node polyfills library? Would it make a difference? Also, in case it helps, the library that needs the Node built ins is isolated in a client-only plugin. It provides a helper class that is used throughout some parts of the app. The library is @web3auth/single-factor-auth in case anyone has experience with it too. I would love to just use their node sdk on the backend but can't due to business and compliance reasons. Any insight or tips would be appreciated!
1 replies