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

When global Node.js objects are referenced, Deno should error out with a friendly error message #17494

Closed
dsherret opened this issue Jan 22, 2023 · 5 comments · Fixed by #26610
Labels
suggestion suggestions for new features (yet to be agreed)

Comments

@dsherret
Copy link
Member

dsherret commented Jan 22, 2023

Extracted from #17475

Objects that will be handled: process, global, Buffer, setImmediate, clearImmediate, module, exports.

Uncaught ReferenceError: process is not defined. 
    To use Node's process object in Deno, add this to `<filename>`:
        import process from "node:process";

For global the hint in the error should be globalThis.global = globalThis.

@dsherret dsherret added the suggestion suggestions for new features (yet to be agreed) label Jan 22, 2023
@aapoalas
Copy link
Collaborator

These should probably be LSP FixIts as well.

@dsherret dsherret mentioned this issue Jan 22, 2023
13 tasks
@calebegg
Copy link

I think this may now be obsolete, as deno appears to create an import for node:process automatically

@dmint789
Copy link

I'm not sure if this belongs here, but I find it annoying that Deno LSP always highlights the process object as a warning, even with the lint rule no-process-globals disabled. It wants me to do the node:process import, but I can't use that in a Next JS application.

@bartlomieju
Copy link
Member

@dmint789 could you please open a new issue for that? This seems like a bug

@dmint789
Copy link

dmint789 commented Oct 27, 2024

@dmint789 could you please open a new issue for that? This seems like a bug

Sure
Edit: #26578

bartlomieju added a commit that referenced this issue Oct 29, 2024
Add info/hint for terminal errors related to Node.js globals:
- __filename
- __dirname
- Buffer
- global
- setImmediate
- clearImmediate

Closes #17494
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
suggestion suggestions for new features (yet to be agreed)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants