Summary
There was a change in behavior between 0.26.0 and 0.27.0 (#152) where process became polyfilled. Even though it already existed.
Existing config:
nodePolyfills({
include: ['buffer', 'util'],
}),
In 0.26.0, process would only be overriden if it didnt exist. Now it's always overwritten. This can be seen from the test changes in the PR, globalThis.Buffer = globalThis.Buffer || __buffer_polyfill The polyfill would only apply when it didn't exist.
expect(result?.code).toEqual(formatWhitespace(`
import __buffer_polyfill from "/shims/buffer/dist/index.js"
globalThis.Buffer = globalThis.Buffer || __buffer_polyfill
import __global_polyfill from "/shims/global/dist/index.js"
globalThis.global = globalThis.global || __global_polyfill
import __process_polyfill from "/shims/process/dist/index.js"
globalThis.process = globalThis.process || __process_polyfill
Buffer.from("test");
`))
I can workaround this by setting:
nodePolyfills({
include: ['buffer', 'util'],
globals: { process: false, global: true, Buffer: true },
}),
Summary
There was a change in behavior between 0.26.0 and 0.27.0 (#152) where
processbecame polyfilled. Even though it already existed.Existing config:
In 0.26.0,
processwould only be overriden if it didnt exist. Now it's always overwritten. This can be seen from the test changes in the PR,globalThis.Buffer = globalThis.Buffer || __buffer_polyfillThe polyfill would only apply when it didn't exist.I can workaround this by setting: