Skip to content

Commit 8310142

Browse files
module: flip experimental-detect-module flags left
1 parent 8e1e3a8 commit 8310142

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

doc/api/modules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ class Point {
207207
export default Point;
208208
```
209209

210-
A CommonJS module can load them with `require()` under `--experimental-detect-module`:
210+
A CommonJS module can load them with `require()`:
211211

212212
```cjs
213213
const distance = require('./distance.mjs');

lib/internal/modules/cjs/loader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1465,7 +1465,7 @@ function wrapSafe(filename, content, cjsModuleInstance, format) {
14651465
};
14661466
}
14671467

1468-
const shouldDetectModule = (format !== 'commonjs' && getOptionValue('--experimental-detect-module'));
1468+
const shouldDetectModule = (format !== 'commonjs' && !getOptionValue('--no-experimental-detect-module'));
14691469
const result = compileFunctionForCJSLoader(content, filename, false /* is_sea_main */, shouldDetectModule);
14701470

14711471
// Cache the source map for the module if present.

lib/internal/modules/esm/get_format.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const {
1515
mimeToFormat,
1616
} = require('internal/modules/esm/formats');
1717

18-
const detectModule = getOptionValue('--experimental-detect-module');
18+
const detectModule = !getOptionValue('--no-experimental-detect-module');
1919
const { containsModuleSyntax } = internalBinding('contextify');
2020
const { getPackageScopeConfig, getPackageType } = require('internal/modules/package_json_reader');
2121
const { fileURLToPath } = require('internal/url');

lib/internal/process/execution.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ function evalScript(name, body, breakFirstLine, print, shouldLoadESM = false) {
8181

8282
const baseUrl = pathToFileURL(module.filename).href;
8383

84-
if (getOptionValue('--experimental-detect-module') &&
84+
if (!getOptionValue('--no-experimental-detect-module') &&
8585
getOptionValue('--input-type') === '' && getOptionValue('--experimental-default-type') === '' &&
8686
containsModuleSyntax(body, name, null, 'no CJS variables')) {
8787
return evalModuleEntryPoint(body, print);

0 commit comments

Comments
 (0)