Skip to content

Commit e35e7a3

Browse files
authored
Document import statements
1 parent 30b91f7 commit e35e7a3

File tree

1 file changed

+8
-1
lines changed
  • commonjs-extension-resolution-loader

1 file changed

+8
-1
lines changed

commonjs-extension-resolution-loader/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@ of file extensions and the ability to import directories that have an index
44
file.
55

66
Use this loader to enable automatic extension resolution and importing from
7-
directories that include an index file.
7+
directories that include an index file, like this:
8+
9+
```js
10+
import file from './file'; // Where ./file is ./file.js or ./file.mjs
11+
import index from './folder'; // Where ./folder is ./folder/index.js or ./folder/index.mjs
12+
```
13+
14+
This loader also applies these automatic resolution rules to the program entry point passed to `node` on the command line:
815

916
```console
1017
$ node index.mjs

0 commit comments

Comments
 (0)