Skip to content

doc: add esm alternative for require.main - #31875

Closed
tschaub wants to merge 1 commit into
nodejs:masterfrom
tschaub:import-meta-main-please
Closed

doc: add esm alternative for require.main#31875
tschaub wants to merge 1 commit into
nodejs:masterfrom
tschaub:import-meta-main-please

Conversation

@tschaub

@tschaub tschaub commented Feb 19, 2020

Copy link
Copy Markdown

This adds the absence of require.main to the list of differences between ES Modules and CommonJS.

Comparing import.meta.url to process.argv[1] is documented as an alternative to require.main === module.

See #49440.

Checklist
  • documentation is changed or added
  • mkdir out/Release
  • ln -s `which node` out/Release/node
  • make test-doc
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the doc Issues and PRs related to the documentations. label Feb 19, 2020
@devsnek

devsnek commented Feb 19, 2020

Copy link
Copy Markdown
Member

You could also add the suggestion of splitting the bin and library into separate files.

@BridgeAR
BridgeAR force-pushed the master branch 2 times, most recently from 8ae28ff to 2935f72 Compare May 31, 2020 12:19
@jasnell

jasnell commented Jul 3, 2020

Copy link
Copy Markdown
Member

Ping @tschaub

@jasnell jasnell added the stalled Issues and PRs that are stalled. label Jul 3, 2020
@tschaub
tschaub force-pushed the import-meta-main-please branch from f64088f to 2d406a3 Compare July 4, 2020 04:59
@tschaub

tschaub commented Jul 4, 2020

Copy link
Copy Markdown
Author

@jasnell - I resolved the conflicts. Let me know if the ping was about something different.

@aduh95

aduh95 commented Oct 16, 2020

Copy link
Copy Markdown
Contributor

@tschaub there are new conflicts to solve. TBH, I'm not sure we want to add this to the docs if it doesn't fit every use case, users would be better off by using es-main npm package, or by splitting the bin and library.

@aduh95 aduh95 added stalled Issues and PRs that are stalled. and removed stalled Issues and PRs that are stalled. labels Oct 19, 2020
@github-actions

Copy link
Copy Markdown
Contributor

This issue/PR was marked as stalled, it will be automatically closed in 30 days. If it should remain open, please leave a comment explaining why it should remain open.

@github-actions

Copy link
Copy Markdown
Contributor

Closing this because it has stalled. Feel free to reopen if this PR is still relevant, or to ping the collaborator who labelled it stalled if you have any questions.

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

Labels

doc Issues and PRs related to the documentations. stalled Issues and PRs that are stalled.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants