mdx v2: import URL causes fail to compile error
See original GitHub issueSubject of the issue
The import {URL} from 'url'
line in recma-document plugin creates a compile error.
I don’t think it’s necessary to import the URL class since it’s a global object?
Your environment
- OS: Window 10 64bit
- Packages: v.2.0.0.rc
- Env: yarn v1.22.15 Next 11.0.1
Steps to reproduce
yarn build
a nextjs project.
Expected behaviour
Project compiles.
Actual behaviour
Failed to compile due to error.
./node_modules/@mdx-js/mdx/lib/plugin/recma-document.js
Attempted import error: 'URL' is not exported from 'url' (imported as 'URL').
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Attempted import error: 'URL' is not exported from 'url ... - GitHub
I am receiving this error when building my Next.js website using next build . ./node_modules/@mdx-js/mdx/lib/plugin/recma-document.js ...
Read more >Next.js MDX blog post not building due to module not found ...
My Next.js project is failing to build on Vercel. I have a BlogAuthor.tsx file as so: import Avatar from "../../Common/Avatar/Avatar" ...
Read more >Troubleshooting MDX
The reason for this error is that the parser is expecting a JavaScript import or export statement. If you want the word import...
Read more >Parcel
$ parcel index.html Server running at http://localhost:1234 Build failed. @parcel/core: Cannot resolve 'ract' from './index.js' /dev/app/index.js: ...
Read more >[Support Guide] Netlify app builds locally but fails on deploy ...
The build seems to be failing on an import line in one of my JS files, but running all the same commands locally,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I worked on the problem a bit more overnight and figured out the problem was caused by the version of nextjs I was using.
The compile error clears when I changed the next package from
"next": "v11.0.1"
to"next": "latest"
.OK, in my case this is related to some project importing
node-url
, and this issue: https://github.com/defunctzombie/node-url/issues/53, https://github.com/defunctzombie/node-url/issues/37 URL not exported.URL
should be available as a global and I don’t understand the comment about TS in that regard, but this trouble is on my end.