Preact: Package path ./compat/jsx-runtime.js is not exported from package
See original GitHub issueHello
I am having issues when replacing React with Preact in production build.
My project can be found at jahirfiquitiva/jahir.dev
And this is the build error I am getting:
info - Creating an optimized production build
Failed to compile.
./node_modules/next-contentlayer/dist/hooks/useMDXComponent.js
Module not found: Package path ./compat/jsx-runtime.js is not exported from package /Users/jahir/dev/jahir/website/node_modules/preact (see exports field in /Users/jahir/dev/jahir/website/node_modules/preact/package.json)
Import trace for requested module:
./node_modules/next-contentlayer/dist/hooks/index.js
./src/pages/blog/[slug].tsx
> Build failed because of webpack errors
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I’m not sure why it started failing if it was working just fine before 😕
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Runtime not exported · Issue #3465 · preactjs/preact - GitHub
Steps to reproduce the behavior: Add project with the provided package.json; See error. Expected behavior. Should run.
Read more >how to fix this error when build next build - Stack Overflow
compat/jsx-runtime.js is not exported from package ... (see exports field in /vercel/path0/node_modules/preact/package.json).
Read more >Use Preact in Next.js 13 - DEV Community
Preact has a package named preact/compat to let developers use React libraries with Preact. Learn more about the differences of Preact from ...
Read more >Switching to Preact (from React)
The preact-compat package provides all the necessary tweaks on top of Preact's core to make it work just like react and react-dom ,...
Read more >assign arrow function to a variable before exporting as module ...
But why can't i do it the other way? ... Some might not allow you to export unnamed functions. ... compat/jsx-runtime.js is not...
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 found a temporary solution, if you want to use
preact@10.6
. You can edit yournext.config.js
to assign the correct alias until this issue gets fixed.Sure… Thanks for the help