Skip to content
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

Failed to import - @mdx-js/mdx #142

Closed
talentlessguy opened this issue Sep 14, 2021 · 5 comments
Closed

Failed to import - @mdx-js/mdx #142

talentlessguy opened this issue Sep 14, 2021 · 5 comments
Labels
types Types is wrong

Comments

@talentlessguy
Copy link
Contributor

talentlessguy commented Sep 14, 2021

Failing module

import * as mod from 'https://esm.sh/@mdx-js/mdx'

Error message

After running deno run I get this:

error: TS2502 [ERROR]: 'thisArg' is referenced directly or indirectly in its own type annotation.
    bind<T>(this: T, thisArg: ThisParameterType<T>): OmitThisParameter<T>;
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at asset:///lib.es5.d.ts:350:22

TS2577 [ERROR]: Return type annotation circularly references itself.
    bind<T>(this: T, thisArg: ThisParameterType<T>): OmitThisParameter<T>;
                                                     ~~~~~~~~~~~~~~~~~~~~
    at asset:///lib.es5.d.ts:350:54

Found 2 errors.

Additional info

  • esm.sh version: v50
  • Deno version: 1.13.2

Analysis

After analyzing the issue I found out it is because helper-function-name.js starts with this import:

import template from "@babel/template";
// below at line 21...
const buildPropertyMethodAssignmentWrapper = template(`... `)

Which is transpiled as

import ___babel_template$ from '/v53/@babel/[email protected]/deno/template.js';
// ...
var N = ___babel_template$;
// ...
j = (0, N.default)(`...`)

So you can see we're importing the default export but then again we try to access it's default property for some reason.

@talentlessguy
Copy link
Contributor Author

from @amatiasq:

➜ deno eval 'import * as mod from \'https://esm.sh/@mdx-js/mdx\''
error: Uncaught TypeError: (0 , N.default) is not a function
    at https://cdn.esm.sh/v53/@babel/[email protected]/deno/helper-function-name.js:2:1429
    at https://cdn.esm.sh/v53/@babel/[email protected]/deno/helper-function-name.js:2:640
    at https://cdn.esm.sh/v53/@babel/[email protected]/deno/helper-function-name.js:26:1406

@amatiasq
Copy link

@talentlessguy Isn't this a different issue? I know they refer to the same module bit the errors que got are different so solving one doesn't necessarily mean the other will be fixed too.

Analysis copied from #167:


After analyzing the issue I found out it is because helper-function-name.js starts with this import:

import template from "@babel/template";
// below at line 21...
const buildPropertyMethodAssignmentWrapper = template(`... `)

Which is transpiled as

import ___babel_template$ from '/v53/@babel/[email protected]/deno/template.js';
// ...
var N = ___babel_template$;
// ...
j = (0, N.default)(`...`)

So you can see we're importing the default export but then again we try to access it's default property for some reason.

@talentlessguy
Copy link
Contributor Author

@amatiasq done, thx

@talentlessguy
Copy link
Contributor Author

still getting on v57:

➜ deno eval --unstable "import * as mod from 'https://esm.sh/@mdx-js/mdx?pin=v57'"
Download https://esm.sh/@mdx-js/mdx?pin=v57
error: Uncaught TypeError: (0 , N.default) is not a function
    at https://cdn.esm.sh/v57/@babel/[email protected]/deno/helper-function-name.js:2:1595
    at https://cdn.esm.sh/v57/@babel/[email protected]/deno/helper-function-name.js:2:806
    at https://cdn.esm.sh/v57/@babel/[email protected]/deno/helper-function-name.js:26:1406

@talentlessguy
Copy link
Contributor Author

it works now on v78

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
types Types is wrong
Projects
None yet
Development

No branches or pull requests

2 participants