components-js
components-js copied to clipboard
NODE_ENV error in component-react/src/utils.ts:44:6
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
which typescript version are you using?
"typescript": "^5"
please provide the exact version number and your build setup.
version 5.4.2 i tried the latest version but still had the same issue
Also, what do you mean by my build setup
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?
Nextjs
thanks. I cannot reproduce this. Can you post your tsconfig file?
{ "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"] }
I think you can reproduce it by installing @livekit and @livekit/component-react in a Nextjs project and try building it locally
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