components-js icon indicating copy to clipboard operation
components-js copied to clipboard

NODE_ENV error in component-react/src/utils.ts:44:6

Open godwinmat opened this issue 1 year ago • 10 comments

Select which package(s) are affected

@livekit/components-react

Describe the bug

(process?.env?.NODE_ENV === 'dev' || // eslint-disable-next-line turbo/no-undeclared-env-vars process?.env?.NODE_ENV === 'development')

When building, the block of code throws an error: Type error: This comparison appears to be unintentional because the types '"development" | "production" | "test"' and '"dev"' have no overlap.

Reproduction

@livekit/components-react

Logs

No response

System Info

MacOS

Severity

blocking an upgrade

Additional Information

No response

godwinmat avatar Sep 10 '24 21:09 godwinmat

which typescript version are you using?

lukasIO avatar Sep 12 '24 10:09 lukasIO

"typescript": "^5"

godwinmat avatar Sep 12 '24 10:09 godwinmat

please provide the exact version number and your build setup.

lukasIO avatar Sep 12 '24 11:09 lukasIO

version 5.4.2 i tried the latest version but still had the same issue

Also, what do you mean by my build setup

godwinmat avatar Sep 12 '24 11:09 godwinmat

you said

When building, the block of code throws an error:

are you invoking tsc directly? Or are you using nextjs/vite/webpack for building?

lukasIO avatar Sep 12 '24 11:09 lukasIO

Nextjs

godwinmat avatar Sep 12 '24 11:09 godwinmat

thanks. I cannot reproduce this. Can you post your tsconfig file?

lukasIO avatar Sep 12 '24 12:09 lukasIO

{ "compilerOptions": { "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "strict": true, "noEmit": true, "esModuleInterop": true, "module": "esnext", "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, "jsx": "preserve", "incremental": true, "plugins": [ { "name": "next" } ], "paths": { "@/": ["./"] } }, "include": [ "server/lib/join-room.js", "server/db.js", "server/index.js", "server/lib/join-room.js", "next-env.d.ts", "/*.ts", "/.tsx", ".next/types/**/.ts", "server.js" ], "exclude": ["node_modules"] }

godwinmat avatar Sep 12 '24 12:09 godwinmat

I think you can reproduce it by installing @livekit and @livekit/component-react in a Nextjs project and try building it locally

godwinmat avatar Sep 12 '24 12:09 godwinmat

I think you can reproduce it by installing https://github.com/livekit and @livekit/component-react in a Nextjs project and try building it locally

we do this in a lot of places, for example here https://github.com/livekit-examples/meet and it doesn't show this error

lukasIO avatar Sep 12 '24 12:09 lukasIO