Skip to content

Commit 30b91f7

Browse files
authored
Create README.md
Copied and pasted from the old documentation for `--experimental-specifier-resolution`
1 parent 985a3c7 commit 30b91f7

File tree

1 file changed

+16
-0
lines changed
  • commonjs-extension-resolution-loader

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Node's ESM specifier resolution does not support all default behavior of
2+
the CommonJS loader. One of the behavior differences is automatic resolution
3+
of file extensions and the ability to import directories that have an index
4+
file.
5+
6+
Use this loader to enable automatic extension resolution and importing from
7+
directories that include an index file.
8+
9+
```console
10+
$ node index.mjs
11+
success!
12+
$ node index # Failure!
13+
Error: Cannot find module
14+
$ node --loader=./loader.js index
15+
success!
16+
```

0 commit comments

Comments
 (0)