Skip to content

doc: clarify execution timing and common use cases of --require flag#62041

Open
kishanngowda wants to merge 1 commit intonodejs:mainfrom
kishanngowda:docs-improve-cli-example
Open

doc: clarify execution timing and common use cases of --require flag#62041
kishanngowda wants to merge 1 commit intonodejs:mainfrom
kishanngowda:docs-improve-cli-example

Conversation

@kishanngowda
Copy link

Improves clarity of the --require CLI flag documentation.

Adds a short explanation clarifying that the module is executed
before the main application entry point, and provides common
real-world use cases such as configuration setup, instrumentation,
or polyfills.

This change improves readability without modifying behavior.

@nodejs-github-bot nodejs-github-bot added cli Issues and PRs related to the Node.js command line interface. doc Issues and PRs related to the documentations. labels Feb 28, 2026
set up instrumentation, or apply polyfills before any application
code runs.

Modules preloaded with `--require` will run before modules preloaded with `--import`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's true that it's both before the entry point and before --import, but it might be worth giving the actual timeline

Suggested change
Modules preloaded with `--require` will run before modules preloaded with `--import`.
Modules preloaded with `--require` will run before modules preloaded with `--import`, which will run before the program entry point is executed.

Comment on lines +2457 to +2458
Preload the specified module at startup, before the main entry point
of the application is executed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the other suggestion, we should remove it here to avoid duplication

Suggested change
Preload the specified module at startup, before the main entry point
of the application is executed.
Preload the specified module at startup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli Issues and PRs related to the Node.js command line interface. doc Issues and PRs related to the documentations.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants