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

Error importing jsx-runtime #24

Closed
philohelp opened this issue Jul 17, 2022 · 6 comments
Closed

Error importing jsx-runtime #24

philohelp opened this issue Jul 17, 2022 · 6 comments

Comments

@philohelp
Copy link

I get this error using nextJs:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '~/node_modules/react/jsx-runtime' imported from ~/node_modules/react-plock/index.js
Did you mean to import react/jsx-runtime.js?
@askides
Copy link
Owner

askides commented Jul 17, 2022

Can you please provide your next version?

@philohelp
Copy link
Author

Sure: Next.js v12.0.8

@philohelp
Copy link
Author

To make Plock work fine I use this code with js and no typescript:

import Card from './card'

import dynamic from 'next/dynamic'

const Plock = dynamic(
  import('react-plock').then((mod) => mod.Plock),
  { ssr: false }
)

export default function BodySuppliers({
  hits,
  toggleModal,
  addedClasses = '',
}) {
  const breakpoints = [
    { size: 640, columns: 1 },
    { size: 768, columns: 2 },
    { size: 1024, columns: 3 },
    { size: 1280, columns: 4 },
    { size: 1536, columns: 6 },
  ]
  return (
    <div className={`${addedClasses}`}>
      <Plock nColumns={breakpoints} gap={15}>
        {hits.map((hit) => (
          <div key={hit.objectID} className="max-w-[250px]">
            <Card hit={hit} toggleModal={toggleModal} />
          </div>
        ))}
      </Plock>
    </div>
  )
}

@Ekaji
Copy link

Ekaji commented Jul 26, 2022

while running npm run build i got a similar error
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/user/Documents/work/myproject/node_modules/react/jsx-runtime' imported from /home/user/Documents/work/myproject/node_modules/react-plock/index.js Did you mean to import react/jsx-runtime.js?
i resolved it by reaching into /node_modules/react-plock/index.js and changing
the first line from
import { jsx } from 'react/jsx-runtime';
to
import { jsx } from 'react/jsx-runtime.js';

ofcourse this might not be an ideal solution.

@askides
Copy link
Owner

askides commented Mar 3, 2023

Hello Guys.

Please check out the new v3.0.0 version just published. In addition to a number of performance and bundle size improvements, the problem you reported has been fixed.

@askides askides closed this as completed Mar 3, 2023
@philohelp
Copy link
Author

I love this lib ! Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants