-
Notifications
You must be signed in to change notification settings - Fork 36
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
feat: added native esm support #1159
Conversation
e810212
to
36bfa8d
Compare
f04d8f9
to
9431241
Compare
5a39f51
to
0da88e8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added some first questions :)
packages/collector/test/tracing/cloud/aws-sdk/v2/dynamodb/test.js
Outdated
Show resolved
Hide resolved
e11c681
to
025d36f
Compare
packages/core/src/util/esm.js
Outdated
(process.execArgv[0].indexOf('--import') !== -1 && process.execArgv[1].indexOf('esm-register.mjs') !== -1))); | ||
|
||
// @ts-ignore | ||
require.cache[cacheKey] = { exports: isESM }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
require.cache is a file cache. Please do not abuse it for caching a local variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some more questions
39a1e37
to
26dedbf
Compare
I will merge & approve this til Monday. We will release it next week |
26dedbf
to
f7af213
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requested two more chances
packages/core/src/util/hook.js
Outdated
* | ||
* This array lists all the libraries that are native ECMAScript Modules. | ||
*/ | ||
const pureEsmLibraries = ['square-calc']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be changed as well. This is no longer correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The best approach I guess is:
hook.onModuleLoad('square-calc', { nativeEsm: true})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the code
6d9eaba
to
ee311a9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥳
Support native ESM modules using IITM
refs INSTA-807
Tasks:
got
ornative-fetch
.Cases
The
import-in-the-middle
(IITM) package throws a "Cannot find module" error when importing the Prisma package from a test folder (basically running our prisma esm tests ) on Node.js version 18.19 and above. This issue does not occur if the Prisma client is installed in the rootpackage.json
or if the IITM hook is not used.See nodejs/import-in-the-middle#97