Skip to content

Commit ec758c0

Browse files
committed
Merge pull request #1 from bmeck/master
tweaks
2 parents 62776d6 + 1d48b5a commit ec758c0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ bar/
136136
- The word "default" has a special, and similar meaning in ES6 modules.
137137
- Despite "default" being a common English word, "default.js" is not widely used as a file name.
138138

139-
In a random sampling of 25,000 NPM packages (10% of the total number of packages), "default.js" was only found one time in a package root. This particular "default.js" file was already an ES6 module. As a filename, "default.js" was found only 174 times. By contrast, "index.js" was found 22,607 times, and in the package root 10,282 times.
139+
In a [search of all the filenames in the @latest NPM packages as of 2016-01-28](https://gist.github.com/bmeck/9b234011938cd9c1f552d41db97ad005), "default.js" was only found 23 times in a package root. This particular "default.js" file was already an ES6 module. As a filename, "default.js" was found 1968 times. By contrast, "index.js" was found 22,607 times, and in the package root 10,282 times.
140+
140141

141142
## Running Modules from the Command Line
142143

@@ -146,7 +147,11 @@ When a user executes
146147
$ node my-module.js
147148
```
148149

149-
from the command line, there is absolutely no way for Node to tell whether "my-module.js" is a legacy CJS module or an ES6 module. In the interest of backward compatibility, Node should probably attempt to load the file as a CJS module, and fallback to ES6 if there is a syntax error indicating the presence of `import` declarations. As people move away from CJS modules in general, future Node versions can assume that the file is an ES6 module.
150+
from the command line, there is absolutely no way for Node to tell whether "my-module.js" is a legacy CJS module or an ES6 module. Due to the need of this knowledge for various interactive scenarios such as the entry file being provided over STDIN, node will support a `--module` flag.
151+
152+
```sh
153+
$ node --module my-module.js
154+
```
150155

151156
## Lookup Algorithm Psuedo-Code
152157

0 commit comments

Comments
 (0)