-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fail to load request-promise-native
with --experimental-modules
#25310
Comments
/ping @nodejs/modules Standard disclaimer: Since modules are experimental, breaking changes can happen at any time, so this might just be one of those things where you (or in this case, perhaps one of the modules in your dependencies) use something that's explicitly unstable and stuff breaks on you unexpectedly. |
same on Mac Mohave and node 11.9.0, rolling back to 11.3.0 fixed it |
I finally figured out the logic of why cjs to esm is always broken... should hopefully have a fix in the next few days. |
When attempting: import blockchainWalletService from 'blockchain-wallet-service' I'm getting:
It works fine when using const blockchainWalletService = require('blockchain-wallet-service') Node.js v10.15.3 |
Duplicate: #25482 |
I encountered this as well, and solved it using the following hack: // Disable stealthy-require as it breaks ESM in modernish node
// 1. Load stealthy-require into the require cache. This way all the module
// machinery gets run like normal.
require("stealthy-require")
// 1. Overwrite the real function with a dummy one
require.cache[require.resolve("stealthy-require")].exports = notSoSthealthyRequire
// 3. Dummy implementation that calls the provided callbacks in the right order
// but doesn't do anything fancy to the require cache.
function notSoSthealthyRequire(_requireCache, callback, callbackForModulesToKeep, _module) {
callbackForModulesToKeep()
return callback()
} |
This seems to be fixed in latest v12.x |
Hi,
I've been using experimental modules for some time now, but encountered an issue with node-11.4 in combination with
request-promise-native
. The mentioned module is usingstealthy-request
to do something clever.Below is an example command that illustrates the problem by throwing an error in node-11.{4,5,6}, but exits successfully in node-11.3.
I attempted to bisect the source and found 1743568 from #24560 to have introduced the change in behavior (@MylesBorins).
I'm not sure if this is an issue with node or if
stealthy-require
is doing something it shouldn't, but I figured I should mentioned it anyway.The error thrown:
The text was updated successfully, but these errors were encountered: