profile
viewpoint

Ask questions--es-module-specifier-resolution=node not working from v13.0.1

--es-module-specifier-resolution=node is documented for v13.x:

Screen Shot 2019-11-18 at 7 16 48 pm

Here is the specific example that works in v13.0.0, but not in v13.0.1 or v13.1.0:

node --experimental-modules --es-module-specifier-resolution=node index

Screen Shot 2019-11-18 at 7 29 02 pm

As you can see in the screenshot above, the error is:

internal/modules/cjs/loader.js:895
    throw err;
    ^

Error: Cannot find module '/Users/jaydenseric/Desktop/test/index'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:892:15)
    at Function.Module._load (internal/modules/cjs/loader.js:785:27)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1143:12)
    at internal/main/run_main_module.js:16:11 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
nodejs/node

Answer questions bolinfest

@guybedford when I create extensions.js as you describe and run:

$ cat extensions.js
// https://github.com/nodejs/node/issues/30520
require._extensions['.mjs'] = require._extensions['.js'];
$ node -r extensions.js --es-module-specifier-resolution=node --experimental-modules lib/server/main.js

I get:

internal/modules/cjs/loader.js:979
  throw err;
  ^

Error: Cannot find module 'extensions.js'
Require stack:
- internal/preload
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:976:15)
    at Function.Module._load (internal/modules/cjs/loader.js:859:27)
    at Module.require (internal/modules/cjs/loader.js:1036:19)
    at Module._preloadModules (internal/modules/cjs/loader.js:1292:12)
    at loadPreloadModules (internal/bootstrap/pre_execution.js:448:5)
    at prepareMainThreadExecution (internal/bootstrap/pre_execution.js:71:3)
    at internal/main/run_main_module.js:7:1 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ 'internal/preload' ]
}

what am I missing?

useful!

Related questions

--max-http-header-size= is not allowed in NODE_OPTIONS hot 8
Crash with "req.handle.writev is not a function" on Socket.Writable.uncork hot 2
pkg-exports: "." errors without a specified `main` hot 2
shutdown ENOTCONN on TLS.Socket._final hot 2
HTTP/2 requests eventually start throwing NGHTTP2_ENHANCE_YOUR_CALM errors hot 2
stream.finished behaviour change hot 2
Assertion `(parser->current_buffer_len_) == (0)' failed hot 1
Node.js 12.10 throwing EPROTO on HTTPS request hot 1
Remove util.inherits usage internally? hot 1
[Bug] Node 10.1.0 TLS issue with ldap: Client network socket disconnected before secure TLS connection was established hot 1
ReferenceError: internalBinding is not defined hot 1
Incorrect timezone hot 1
HPE_INVALID_HEADER_TOKEN on http requests hot 1
HPE_INVALID_HEADER_TOKEN on http requests hot 1
crypto, bad decrypt hot 1
Github User Rank List