@@ -25,16 +25,14 @@ For more info about `node inspect`, see the [debugger][] documentation.
25
25
26
26
The program entry point is a specifier-like string. If the string is not an
27
27
absolute path, it's resolved as a relative path from the current working
28
- directory. That path is then resolved by [ CommonJS] [ ] module loader, or by the
29
- [ ES module loader] [ Modules loaders ] if [ ` --experimental-default-type=module ` ] [ ]
30
- is passed. If no corresponding file is found, an error is thrown.
28
+ directory. That path is then resolved by [ CommonJS] [ ] module loader. If no
29
+ corresponding file is found, an error is thrown.
31
30
32
31
If a file is found, its path will be passed to the
33
32
[ ES module loader] [ Modules loaders ] under any of the following conditions:
34
33
35
34
* The program was started with a command-line flag that forces the entry
36
- point to be loaded with ECMAScript module loader, such as ` --import ` or
37
- [ ` --experimental-default-type=module ` ] [ ] .
35
+ point to be loaded with ECMAScript module loader, such as ` --import ` .
38
36
* The file has an ` .mjs ` extension.
39
37
* The file does not have a ` .cjs ` extension, and the nearest parent
40
38
` package.json ` file contains a top-level [ ` "type" ` ] [ ] field with a value of
@@ -47,9 +45,8 @@ Otherwise, the file is loaded using the CommonJS module loader. See
47
45
48
46
When loading, the [ ES module loader] [ Modules loaders ] loads the program
49
47
entry point, the ` node ` command will accept as input only files with ` .js ` ,
50
- ` .mjs ` , or ` .cjs ` extensions; with ` .wasm ` extensions when
51
- [ ` --experimental-wasm-modules ` ] [ ] is enabled; and with no extension when
52
- [ ` --experimental-default-type=module ` ] [ ] is passed.
48
+ ` .mjs ` , or ` .cjs ` extensions; and with ` .wasm ` extensions when
49
+ [ ` --experimental-wasm-modules ` ] [ ] is enabled.
53
50
54
51
## Options
55
52
@@ -896,38 +893,6 @@ and `"` are usable.
896
893
It is possible to run code containing inline types by passing
897
894
[ ` --experimental-strip-types ` ] [ ] .
898
895
899
- ### ` --experimental-default-type=type `
900
-
901
- <!-- YAML
902
- added:
903
- - v21.0.0
904
- - v20.10.0
905
- - v18.19.0
906
- -->
907
-
908
- > Stability: 1.0 - Early development
909
-
910
- Define which module system, ` module ` or ` commonjs ` , to use for the following:
911
-
912
- * String input provided via ` --eval ` or STDIN, if ` --input-type ` is unspecified.
913
-
914
- * Files ending in ` .js ` or with no extension, if there is no ` package.json ` file
915
- present in the same folder or any parent folder.
916
-
917
- * Files ending in ` .js ` or with no extension, if the nearest parent
918
- ` package.json ` field lacks a ` "type" ` field; unless the ` package.json ` folder
919
- or any parent folder is inside a ` node_modules ` folder.
920
-
921
- In other words, ` --experimental-default-type=module ` flips all the places where
922
- Node.js currently defaults to CommonJS to instead default to ECMAScript modules,
923
- with the exception of folders and subfolders below ` node_modules ` , for backward
924
- compatibility.
925
-
926
- Under ` --experimental-default-type=module ` and ` --experimental-wasm-modules ` ,
927
- files with no extension will be treated as WebAssembly if they begin with the
928
- WebAssembly magic number (` \0asm ` ); otherwise they will be treated as ES module
929
- JavaScript.
930
-
931
896
### ` --experimental-transform-types `
932
897
933
898
<!-- YAML
@@ -1404,7 +1369,7 @@ added: v12.0.0
1404
1369
1405
1370
This configures Node.js to interpret ` --eval ` or ` STDIN ` input as CommonJS or
1406
1371
as an ES module. Valid values are ` "commonjs" ` or ` "module" ` . The default is
1407
- ` "commonjs" ` unless [ ` --experimental-default-type=module ` ] [ ] is used .
1372
+ ` "commonjs" ` .
1408
1373
1409
1374
The REPL does not support this option. Usage of ` --input-type=module ` with
1410
1375
[ ` --print ` ] [ ] will throw an error, as ` --print ` does not support ES module
@@ -3057,7 +3022,6 @@ one is included in the list below.
3057
3022
* ` --enable-source-maps `
3058
3023
* ` --entry-url `
3059
3024
* ` --experimental-abortcontroller `
3060
- * ` --experimental-default-type `
3061
3025
* ` --experimental-detect-module `
3062
3026
* ` --experimental-eventsource `
3063
3027
* ` --experimental-import-meta-resolve `
@@ -3620,7 +3584,6 @@ node --stack-trace-limit=12 -p -e "Error.stackTraceLimit" # prints 12
3620
3584
[ `--diagnostic-dir` ] : #--diagnostic-dirdirectory
3621
3585
[ `--env-file-if-exists` ] : #--env-file-if-existsconfig
3622
3586
[ `--env-file` ] : #--env-fileconfig
3623
- [ `--experimental-default-type=module` ] : #--experimental-default-typetype
3624
3587
[ `--experimental-sea-config` ] : single-executable-applications.md#generating-single-executable-preparation-blobs
3625
3588
[ `--experimental-strip-types` ] : #--experimental-strip-types
3626
3589
[ `--experimental-wasm-modules` ] : #--experimental-wasm-modules
0 commit comments