refine icon indicating copy to clipboard operation
refine copied to clipboard

[BUG] fix(devtools-internal): fix NODE_ENV conditional didn't work

Open sanchezcarlosjr opened this issue 8 months ago • 2 comments

Describe the bug

Hello, @aliemir published the PR https://github.com/refinedev/refine/pull/5992 and it works. However, esbuild doesn't compile as expected. The compiler doesn't generate correctly as you write here https://github.com/refinedev/refine/blob/4654353b90b6a09cbf65e41d4c1fa82553a2a3fa/packages/devtools-internal/src/use-query-subscription.tsx#L13 So, instead of

() => {
        return {};
      }

it generates

() => ({})

Steps To Reproduce

  1. Install @refinedev/devtools-internal or visit the link @refinedev/devtools-internal npm package code tab
  2. Check the below expression in index.cjs and index.mjs.
process.env.NODE_ENV!=="development" ? ()=>({})  : ...

Expected behavior

The below expression

process.env.NODE_ENV!=="development" ? ()=>({}): ...

must be something similar to

process.env.NODE_ENV!=="development" ? ()=> {
   return {};
}: ...

Probably adding a noop function helps.

const noop = () => {
   return {};
}

process.env.NODE_ENV!=="development" ? noop: ...

Packages

  • @refinedev/devtools-internal:1.1.11

Additional Context

No response

sanchezcarlosjr avatar Jun 10 '24 16:06 sanchezcarlosjr