Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
godwinmat opened this issue Sep 10, 2024 · 10 comments
Open

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

godwinmat opened this issue Sep 10, 2024 · 10 comments

Comments

@godwinmat
Copy link

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

@lukasIO
Copy link
Contributor

lukasIO commented Sep 12, 2024

which typescript version are you using?

@godwinmat
Copy link
Author

"typescript": "^5"

@lukasIO
Copy link
Contributor

lukasIO commented Sep 12, 2024

please provide the exact version number and your build setup.

@godwinmat
Copy link
Author

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

Also, what do you mean by my build setup

@lukasIO
Copy link
Contributor

lukasIO commented Sep 12, 2024

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?

@godwinmat
Copy link
Author

Nextjs

@lukasIO
Copy link
Contributor

lukasIO commented Sep 12, 2024

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

@godwinmat
Copy link
Author

{
"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
Copy link
Author

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

@lukasIO
Copy link
Contributor

lukasIO commented Sep 12, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants