Closed eunsukimme closed 1 year ago
Thanks for the report, @eunsukimme!
Is there a reason you are sticking to React 17 and not upgrading to React 18?
Since this is a version-specific issue, could you provide a minimal reproduction of the issue?
Hi @angeloashmore!
Actually this error occurs on my company codebase, and there are many teams collaborating on the codebase. So I think it's not easy to migrate React version in the near future. So I created this issue and suggested a solution at library-level to edit build configuration of @slicemachine/adapter-next/simulator
.
Now I'll make a minimal reproduction of the issue.
Hi @eunsukimme,
I am doing some QA on this issue, did you have a chance to create minimal reproduction of the issue?
Thanks,
Hi @eunsukimme,
We're closing this issue for now. Let us know if it is still blocking and we'll re open it.
Thanks
Versions
Reproduction
I'm using Next.js(v12.3.1) and React/ReactDom(v17.0.2). When I import
@slicemachine/adapter-next/simulator
, I get an errorError: Cannot find module 'react/jsx-runtime'
Screenshot & package.json
``` { "dependencies": { "@prismicio/client": "^7.1.0", "@prismicio/next": "^0.1.8", "@prismicio/react": "^2.6.2", "@reduxjs/toolkit": "^1.6.2", "next": "12.3.1", "react": "17.0.2", "react-dom": "17.0.2", "react-redux": "^7.2.6", }, "devDependencies": { "@slicemachine/adapter-next": "^0.2.1", "@types/node": "^17.0.30", "@types/react": "17.0.36", "@types/react-dom": "17.0.15", "@types/react-redux": "^7.1.20", "@types/react-slick": "^0.23.8", "slice-machine-ui": "^1.2.0", "typescript": "^4.8.4" } } ```
Steps to reproduce
import { SliceSimulator } from '@slicemachine/adapter-next/simulator'
What is expected?
Import works nomally.
What is actually happening?
I got
Error: Cannot find module 'react/jsx-runtime'
error.Currently
@slicemachine/adapter-next/simulator
built with automatic JSX runtime. So build result includeimport { jsx } from "react/jsx-runtime";
but It occurs error on esm from Webpack 5 / Node.js using React v17. So I suggest change vite configuration of this package to use classic jsx runtime to support this environments.