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

Version 3 supports only React 18+, it's an undocumented breaking change #520

Closed
wojtekmaj opened this issue Oct 3, 2023 · 1 comment
Closed
Labels
documentation Improvements or additions to documentation

Comments

@wojtekmaj
Copy link
Contributor

wojtekmaj commented Oct 3, 2023

Describe the bug

Version 3 has an undocumented breaking change, that it no longer works with React v17, I believe. Upon updating from @ladle/react from 2.15.0 to 3.2.1 in a repository using React 17, I immediately got an error:

Failed to resolve import "react-dom/client" from "../node_modules/@ladle/react/typings-for-build/app/src/index.js?v=4ad74726". Does the file exist?
10:13:37 [vite] Internal server error: Failed to resolve import "react-dom/client" from "../node_modules/@ladle/react/typings-for-build/app/src/index.js?v=4ad74726". Does the file exist?
  Plugin: vite:import-analysis
  File: /Users/wmaj/Projekty/Rewardo/packages/node_modules/@ladle/react/typings-for-build/app/src/index.js?v=4ad74726:2:34
  1  |  import { jsx as _jsx } from "react/jsx-runtime";
  2  |  import * as ReactDOMClient from "react-dom/client";
     |                                   ^
  3  |  import App from "./app";
  4  |  const container = document.getElementById("ladle-root");
      at formatError (/packages/node_modules/vite/dist/node/chunks/dep-df561101.js:43993:46)
      at TransformContext.error (/packages/node_modules/vite/dist/node/chunks/dep-df561101.js:43989:19)
      at normalizeUrl (/packages/node_modules/vite/dist/node/chunks/dep-df561101.js:41801:33)
      at async /packages/node_modules/vite/dist/node/chunks/dep-df561101.js:41945:47
      at async Promise.all (index 1)
      at async TransformContext.transform (/packages/node_modules/vite/dist/node/chunks/dep-df561101.js:41870:13)
      at async Object.transform (/packages/node_modules/vite/dist/node/chunks/dep-df561101.js:44283:30)
      at async loadAndTransform (/packages/node_modules/vite/dist/node/chunks/dep-df561101.js:54950:29)
      at async viteTransformMiddleware (/packages/node_modules/vite/dist/node/chunks/dep-df561101.js:64345:32)

Suggestions:

  • Document the breaking change
  • Properly set react and react-dom peerDependencies
@wojtekmaj wojtekmaj added the needs triage needs to be reviewed label Oct 3, 2023
@tajo
Copy link
Owner

tajo commented Oct 3, 2023

Yea, React v18+ only for v3. I forgot to put it into the notes/blogpost. Updated.

You should also get error/warning from the package manager.

@tajo tajo closed this as completed Oct 3, 2023
@tajo tajo changed the title Version 3 has an undocumented breaking change Version 3 supports only React 18+, it's an undocumented breaking change Oct 3, 2023
@tajo tajo added documentation Improvements or additions to documentation and removed needs triage needs to be reviewed labels Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants