We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Suggestion: On the page https://bucklescript.github.io/docs/en/nodejs-special-variables.html , add the following example:
/** * Is the current file being run from the shell? * @param _module Call with [%bs.node _module] */ let isMain = (_module: option(Node.node_module)) => { let require: option(Node.node_require) = [%bs.node require]; switch (require, _module) { | (Some(require'), Some(_module')) => switch (Js.undefinedToOption(require'##main)) { | Some(main') => main' === _module' | None => Js.Exn.raiseError("Illegal state") }; | _ => Js.Exn.raiseError("Illegal state") }; };
Created with help from Glenn Slotte. https://reasonml.chat/t/where-are-node-module-and-node-require/191
The text was updated successfully, but these errors were encountered:
Webpage source is here btw, if you'd like to make it a PR.
Sorry, something went wrong.
@glennsl Right. Let’s pause this and I’ll submit a PR with (a simplified version) of this example.
No branches or pull requests
Suggestion: On the page https://bucklescript.github.io/docs/en/nodejs-special-variables.html , add the following example:
Created with help from Glenn Slotte. https://reasonml.chat/t/where-are-node-module-and-node-require/191
The text was updated successfully, but these errors were encountered: