Closed mohd-akram closed 1 month ago
I haven't seen one before!
Can you try applying this patch which combines a load of outstanding PRs and see if that fixes it?
Tried it, it doesn't work. It only patches hook.js
while the problem is in get-esm-exports.js
.
I've tried reproducing this with a simple export default parseInt("1")
but it parses without error. Do you have a more full example to reproduce this?
The issue only happens when defaultAs
is provided, as in the one-liner I mentioned. I imagine it comes from here in the library where this happens. The code expects a function node but doesn't check the type: https://github.com/DataDog/import-in-the-middle/blob/bf3a4fbb0b0a4fd806aefb8d2a598894303a0ebf/lib/get-esm-exports.js#L67-L70
Expected Behavior
Works.
Actual Behavior
Steps to Reproduce the Problem
I'm getting this after updating Sentry to 8.x. I'm not sure where exactly
import-in-the-middle
is being called from, but the gist of it is that it is crashing on this file (node_modules/adminjs/lib/frontend/components/app/sort-link.js
) because it has a function call in the export.require('import-in-the-middle/lib/get-esm-exports')({moduleSource: 'export default parseInt("1");', defaultAs: 'SortLink'})
Specifications