File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -74,9 +74,8 @@ run directly by testing `require.main === module`.
7474For a file ` foo.js ` , this will be ` true ` if run via ` node foo.js ` , but
7575` false ` if run by ` require('./foo') ` .
7676
77- Because ` module ` provides a ` filename ` property (normally equivalent to
78- ` __filename ` ), the entry point of the current application can be obtained
79- by checking ` require.main.filename ` .
77+ When the entry point is not a CommonJS module, ` require.main ` is ` undefined ` ,
78+ and the main module is out of reach.
8079
8180## Package manager tips
8281
@@ -716,10 +715,11 @@ extensions gets slower with each registered extension.
716715added: v0.1.17
717716-->
718717
719- * {module}
718+ * {module | undefined }
720719
721720The ` Module ` object representing the entry script loaded when the Node.js
722- process launched.
721+ process launched, or ` undefined ` if the entry point of the program is not a
722+ CommonJS module.
723723See [ "Accessing the main module"] ( #accessing-the-main-module ) .
724724
725725In ` entry.js ` script:
You can’t perform that action at this time.
0 commit comments