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

Error: Could not resolve './dirname-messed-up.cjs' from ./dirname-messed-up.cjs?commonjs-external #22

Closed
rbusquet opened this issue Apr 13, 2021 · 3 comments · Fixed by #23
Labels

Comments

@rbusquet
Copy link

  • mdx-bundler version: 3.2.0
  • node version: 14.16
  • npm version: 6.14.11

What you did: Upgraded mdx-bundler on a remix.run project

What happened:

Building Remix app for production...
Error: Could not resolve './dirname-messed-up.cjs' from ./dirname-messed-up.cjs?commonjs-external
    at error (<redacted-repo dir>/node_modules/rollup/dist/shared/rollup.js:5305:30)
    at ModuleLoader.handleResolveId (<redacted-repo dir>/node_modules/rollup/dist/shared/rollup.js:18531:24)
    at <redacted-repo dir>/node_modules/rollup/dist/shared/rollup.js:18487:22
    at async Promise.all (index 0)
    at async ModuleLoader.fetchStaticDependencies (<redacted-repo dir>/node_modules/rollup/dist/shared/rollup.js:18485:34)
    at async Promise.all (index 0)
    at async ModuleLoader.fetchModule (<redacted-repo dir>/node_modules/rollup/dist/shared/rollup.js:18461:9)
    at async Promise.all (index 10)
    at async ModuleLoader.fetchStaticDependencies (<redacted-repo dir>/node_modules/rollup/dist/shared/rollup.js:18485:34)
    at async Promise.all (index 0)

Problem description: Something might be wrong in the implementation of #21

Suggested solution: Unfortunately I don't have a lot of background to suggest a solution. Thought about reporting given that the error seems related to #21 which was just released.

@kentcdodds
Copy link
Owner

Whoops! Looks like when babel compiles it, it removes the .cjs and renames it to .js: https://unpkg.com/browse/[email protected]/dist/

Bummer. I think this is such a one-off thing that we can just hack this to make it work. We're doing some wonky things in this repo thanks to the native ESM mix of our deps and current lack of support from tools.

Luckily, I see this project as mostly "done" so I'm not worried about the long-term maintainability of these workarounds 😅

@kentcdodds
Copy link
Owner

Here we go: #23
That should fix it.

@github-actions
Copy link

🎉 This issue has been resolved in version 3.2.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

2 participants