Unverified Commit 7b66e8ae authored by Kiko Beats's avatar Kiko Beats Committed by GitHub

fix: explicit undefined typecheck (#48920)

The current implementation is throwing wrongly if you set a falsy JS value (like `0` or `null`)

So right now this is fail even it's a legit implementation: `process.counter = 0`
parent 678c6975
...@@ -117,7 +117,7 @@ function createProcessPolyfill(options: Pick<ModuleContextOptions, 'env'>) { ...@@ -117,7 +117,7 @@ function createProcessPolyfill(options: Pick<ModuleContextOptions, 'env'>) {
if (key === 'env') continue if (key === 'env') continue
Object.defineProperty(processPolyfill, key, { Object.defineProperty(processPolyfill, key, {
get() { get() {
if (overridenValue[key]) { if (overridenValue[key] !== undefined) {
return overridenValue[key] return overridenValue[key]
} }
if (typeof (process as any)[key] === 'function') { if (typeof (process as any)[key] === 'function') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment