Uh oh!
There was an error while loading. Please reload this page.
module: throw on require('./path.mjs'); - #27417
Conversation
nodejs-github-bot
commented
Apr 25, 2019
MylesBorins
commented
Apr 25, 2019
Alternatively... if this is not viewed as a breaking change (adding throw to require) we can punt on this until later. I think it likely is though, in which case we should try and get this landed + out in the wild ASAP if we can reach consensus |
ljharb
left a comment
There was a problem hiding this comment.
Anybody doing anything useful with requiring an .mjs extension, without the flag, would have had to install their own require.extensions handler. If they've done that, this won't break them. If they haven't, requiring an .mjs file would fail to parse anything with import or export in it, and throw, which I would assume is the common case.
Thus, while this is technically breaking, imo it seems very very safe, and I agree with the logic that this was a bug in the ESM implementation.
MylesBorins
commented
Apr 25, 2019
Also, this requires tests / docs. Will update assuming we have consensus to make this change |
MylesBorins
commented
Apr 25, 2019
A qq. If we add this, would removing it in the future be Semver-Patch or Semver-Major? |
weswigham
commented
Apr 25, 2019
Removing an error is normally considered semver patch, right? Since it's just an enhancement? |
mcollina
left a comment
There was a problem hiding this comment.
This should add a unit test as well.
mcollina
commented
Apr 25, 2019
I’m +1 in landing this in Node 12.0.0 |
rvagg
left a comment
There was a problem hiding this comment.
everyone gets a .1 for this kind of thing
is there a reference to a discussion or modules roadmap that has this in it that can help with justification?
MylesBorins
commented
Apr 30, 2019
Running CI + CITGM. If things look good I'm going to document change and then land... eta 48 hours |
sam-github
commented
May 1, 2019
I will resume this, despite what the log looks like, I think what actually failed is jenkins. Because the java stack got inserted into the |
nodejs-github-bot
commented
May 1, 2019
beb834e to
62fe651CompareMylesBorins
commented
May 1, 2019
added basic test + doc ptal |
nodejs-github-bot
commented
May 1, 2019
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
nodejs-github-bot
commented
May 2, 2019
MylesBorins
commented
May 2, 2019
@Trott I took all your suggestions and tweaked a bit more. Rebased the branch to clean up the noise. Feel free to edit away and push on the branch. |
nodejs-github-bot
commented
May 3, 2019
nodejs-github-bot
commented
May 3, 2019
nodejs-github-bot
commented
May 3, 2019
MylesBorins
commented
May 3, 2019
latest CI was green landed in d370d12 |
This is an extremely important part of the ESM implementation that should have been unflagged as a breaking change in v12.0.0 to allow us to unflag ESM in Node.js 12.x before LTS. Assuming we can get consensus on this behavior I would argue that this Semver-Major behavior change could be viewed as a Semver-Patch fix in v12.0.1 PR-URL: #27417 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
This is an extremely important part of the ESM implementation that should have been unflagged as a breaking change in v12.0.0 to allow us to unflag ESM in Node.js 12.x before LTS. Assuming we can get consensus on this behavior I would argue that this Semver-Major behavior change could be viewed as a Semver-Patch fix in v12.0.1 PR-URL: #27417 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Notable changes: * tls: * Added an `enableTrace()` method to `TLSSocket` and an `enableTrace` option to `tls.createServer()`. When enabled, TSL packet trace information is written to `stderr`. This can be used to debug TLS connection problems. #27497 * cli: * Added a `--trace-tls` command-line flag that enables tracing of TLS connections without the need to modify existing application code. #27497 * Added a `--cpu-prof-interval` command-line flag. It can be used to specify the sampling interval for the CPU profiles generated by `--cpu-prof`. #27535 * module: * Added the `createRequire()` method. It allows to create a require function a file URL object, a file URL string or an absolute path string. The existing `createRequireFromPath()` method is now deprecated #27405. * Throw on `require('./path.mjs')`. This is technically a breaking change that should have landed with Node.js 12.0.0. It is necessary to have this to keep the possibility for a future minor version to load ES Modules with the require function. #27417 * meta: * Added Christian Clauss (https://github.com/cclauss) to collaborators. #27554 PR-URL: #27578
Notable changes: * deps: * Updated llhttp to 1.1.3. This fixes a bug that made Node.js' HTTP parser refuse any request URL that contained the "|" (vertical bar) character. #27595 * tls: * Added an `enableTrace()` method to `TLSSocket` and an `enableTrace` option to `tls.createServer()`. When enabled, TSL packet trace information is written to `stderr`. This can be used to debug TLS connection problems. #27497#27376 * cli: * Added a `--trace-tls` command-line flag that enables tracing of TLS connections without the need to modify existing application code. #27497 * Added a `--cpu-prof-interval` command-line flag. It can be used to specify the sampling interval for the CPU profiles generated by `--cpu-prof`. #27535 * module: * Added the `createRequire()` method. It allows to create a require function from a file URL object, a file URL string or an absolute path string. The existing `createRequireFromPath()` method is now deprecated #27405. * Throw on `require('./path.mjs')`. This is technically a breaking change that should have landed with Node.js 12.0.0. It is necessary to have this to keep the possibility for a future minor version to load ES Modules with the require function. #27417 * repl: * The REPL now supports multi-line statements using `BigInt` literals as well as public and private class fields and methods. #27400 * The REPL now supports tab autocompletion of file paths with `fs` methods. #26648 * meta: * Added Christian Clauss (https://github.com/cclauss) to collaborators. #27554 PR-URL: #27578
Notable changes: * deps: * Updated llhttp to 1.1.3. This fixes a bug that made Node.js' HTTP parser refuse any request URL that contained the "|" (vertical bar) character. #27595 * tls: * Added an `enableTrace()` method to `TLSSocket` and an `enableTrace` option to `tls.createServer()`. When enabled, TSL packet trace information is written to `stderr`. This can be used to debug TLS connection problems. #27497#27376 * cli: * Added a `--trace-tls` command-line flag that enables tracing of TLS connections without the need to modify existing application code. #27497 * Added a `--cpu-prof-interval` command-line flag. It can be used to specify the sampling interval for the CPU profiles generated by `--cpu-prof`. #27535 * module: * Added the `createRequire()` method. It allows to create a require function from a file URL object, a file URL string or an absolute path string. The existing `createRequireFromPath()` method is now deprecated #27405. * Throw on `require('./path.mjs')`. This is technically a breaking change that should have landed with Node.js 12.0.0. It is necessary to have this to keep the possibility for a future minor version to load ES Modules with the require function. #27417 * repl: * The REPL now supports multi-line statements using `BigInt` literals as well as public and private class fields and methods. #27400 * The REPL now supports tab autocompletion of file paths with `fs` methods. #26648 * meta: * Added Christian Clauss (https://github.com/cclauss) to collaborators. #27554 PR-URL: #27578
This is an extremely important part of the ESM implementation
that should have been unflagged as a breaking change in v12.0.0
to allow us to unflag ESM in Node.js 12.x before LTS. Assuming we
can get consensus on this behavior I would argue that this Semver-Major
behavior change could be viewed as a Semver-Patch fix in v12.0.1
Thoughts?
/cc @nodejs/modules @nodejs/tsc