Closed jamesone closed 1 year ago
I was able to reproduce this locally. Will be looking into it today.
@tlhunter I can confirm this is working (I copied the change into my node_modules). Would you be able to update the dd-trace-js library to use the new version of import-in-the-middle
? https://github.com/DataDog/dd-trace-js/issues/2221#issuecomment-1244794142 (related issue that will be fixed with this change)
I tried making the change to dd-trace myself but it looks like 1.3.4. is not yet available on npm.
@jamesone version 1.3.4
has just now been published! I'm now working on getting the change available in the next release of dd-trace
.
We'll still probably release dd-trace
soon, but I believe reinstalling the package should grab the latest version of import-in-the-middle
since we don't pin the version in dd-trace
:
"import-in-the-middle": "^1.3.3",
FYI, new minimum version for import-in-the-middle
has been released to dd-trace
versions v2.16.1
and v3.3.1
.
Awesome @tlhunter I can confirm that the dd-trace issue was fixed by this change
Expected Behavior
Import assertions should be parsed correctly.
i.e.
import contracts from './package.json' assert { type: 'json' };
Actual Behavior
When using the dd-trace/loader-hook.mjs, the nodejs server is unable to start due to the
import-in-the-middle
package failing to parse import assertions. Here is the related issue https://github.com/DataDog/dd-trace-js/issues/2221#issuecomment-1243122554Note: When running node without the dd-trace/loader-hook.mjs, it runs fine (however, this issue still remains)
Steps to Reproduce the Problem
node --experimental-specifier-resolution=node --experimental-loader dd-trace/loader-hook build/src/index.js
- Use the dd-trace/loader-hook in an esm environment. In your build, ensure you have an import assertion, i.e.import contracts from './package.json' assert { type: 'json' };
Specifications
Further notes