Skip to content

Does not handle CallExpression in ExportDefaultDeclaration node #77

Closed
getsentry/sentry-javascript
#12388
@mohd-akram

Description

@mohd-akram

Expected Behavior

Works.

Actual Behavior

TypeError: Cannot read properties of undefined (reading 'name')
    at getEsmExports (/Users/user/code/project/node_modules/import-in-the-middle/lib/get-esm-exports.js:71:59)
    at getExports (/Users/user/code/project/node_modules/import-in-the-middle/lib/get-exports.js:80:12)
    at async processModule (/Users/user/code/project/node_modules/import-in-the-middle/hook.js:134:23)
    at async processModule (/Users/user/code/project/node_modules/import-in-the-middle/hook.js:160:20)
    at async processModule (/Users/user/code/project/node_modules/import-in-the-middle/hook.js:160:20)
    at async processModule (/Users/user/code/project/node_modules/import-in-the-middle/hook.js:160:20)
    at async processModule (/Users/user/code/project/node_modules/import-in-the-middle/hook.js:160:20)
    at async processModule (/Users/user/code/project/node_modules/import-in-the-middle/hook.js:160:20)
    at async getSource (/Users/user/code/project/node_modules/import-in-the-middle/hook.js:269:60)
    at async load (/Users/user/code/project/node_modules/import-in-the-middle/hook.js:335:26)

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.

  1. require('import-in-the-middle/lib/get-esm-exports')({moduleSource: 'export default parseInt("1");', defaultAs: 'SortLink'})

Specifications

  • Version: 1.7.4
  • Platform: macOS
  • Subsystem: ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions