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 #167

Closed
amatiasq opened this issue Sep 22, 2021 · 5 comments
Closed

Failed to import @mdx-js/mdx #167

amatiasq opened this issue Sep 22, 2021 · 5 comments

Comments

@amatiasq
Copy link

amatiasq commented Sep 22, 2021

Failing module

import 'https://esm.sh/@mdx-js/mdx'

Error message

After running

deno eval 'import "https://esm.sh/@mdx-js/mdx"'

I get this:

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

Additional info

  • esm.sh version: v53
  • Deno version: 1.14.0

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.

@amatiasq amatiasq added the bug Something isn't working label Sep 22, 2021
@amatiasq
Copy link
Author

Referenced from mdx-js/mdx#1674

@ije
Copy link
Member

ije commented Sep 22, 2021

@amatiasq thanks for the details, i will look into it!

@talentlessguy
Copy link
Contributor

duplicate of #142

@talentlessguy talentlessguy added duplicate and removed bug Something isn't working labels Sep 25, 2021
@amatiasq
Copy link
Author

@talentlessguy I think the analysis is worth copying too

@ije
Copy link
Member

ije commented Sep 25, 2021

@amatiasq yes, thanks for the details

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

No branches or pull requests

3 participants