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

[Bug]: ReferenceError: process is not defined #5836

Closed
yf-yang opened this issue Jun 16, 2024 · 1 comment
Closed

[Bug]: ReferenceError: process is not defined #5836

yf-yang opened this issue Jun 16, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@yf-yang
Copy link

yf-yang commented Jun 16, 2024

Version

System:
    OS: macOS 13.2.1
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
    Memory: 28.32 MB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Browsers:
    Chrome: 125.0.6422.176
    Safari: 16.3
  npmPackages:
    @modern-js/app-tools: ^2.53.0 => 2.53.0 
    @modern-js/module-tools: ^2.53.0 => 2.53.0 
    @modern-js/plugin-tailwindcss: 2.53.0 => 2.53.0

Details

Idk what's wrong here.

It complains when checking process.env.IS_REACT18.

If modern.config.js set disableNodePolyfill=false, then the error goes away, but process.env.IS_REACT18 is still not correctly set.

Reproduce link

https://github.com/yf-yang/modernjs-monorepo-example/tree/ts-bundler-bug

Reproduce Steps

cd apps/app
pnpm dev

Then open the browser.

@yf-yang yf-yang added the bug Something isn't working label Jun 16, 2024
@yf-yang
Copy link
Author

yf-yang commented Jun 22, 2024

The cause:
In a pnpm workspace, I install @modern-js/app-tools at the root folder. Therefore, its internal appDirectory is resolved the root folder. Then modernjs tries to read its package.json to find the react version.
If I execute the command in a workspace folder which installs React 18, then it could not be correctly resolved.
Add @modern.js/app-tools as dependency of workspace folder can fix the issue.

@yf-yang yf-yang closed this as completed Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant