Closed mward-sudo closed 2 years ago
To work around this error use require
instead of import
.
Thankyou @jecassis - it's not ideal, but it has my code working with Next.js 12, so thank you for the suggestion :)
Getting the same issue on Next.js 12.0.2 and Yarn 3.1 with Zero Installs. @jecassis workaround isn't working for me either and throws
Module not found: ESM packages (remark-unwrap-images) need to be imported. Use 'import' to reference the package instead. https://nextjs.org/docs/messages/import-esm-externals
FWIW, https://github.com/remarkjs/remark-unwrap-images is ESM only
Having the same issue as @bencmbrook with remark
and remark-html
. Downgrading to next 11 didn't resolve the issue either.
Closing as duplicate of #30363
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
What version of Next.js are you using?
12.0.0
What version of Node.js are you using?
16.13.0
What browser are you using?
Safari 15.1
What operating system are you using?
MacOS Monterey
How are you deploying your application?
Vercel
Describe the Bug
Using highlight.js, Next.js 12.0.0, Yarn v3.1.0 with strict PnP, the following error occurs upon page load:
The same code works using Next.js 11.x
Expected Behavior
The import should work correctly and the page should load without error.
To Reproduce
CD in to the project folder.
In
./pages/index.tsx
add the imports:Inside the
Home
arrow function, add theuseEffect
hook:Run the dev server:
Visit http://localhost:3000, note error in terminal log.
See https://github.com/mward-sudo/next12-highlightjs-error for a minimal reproduction.