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

JSX Runtime. #87

Open
christopher-becker opened this issue Mar 9, 2023 · 12 comments
Open

JSX Runtime. #87

christopher-becker opened this issue Mar 9, 2023 · 12 comments

Comments

@christopher-becker
Copy link

Hi I am getting the following error inside a typescript project.

Error:
ERROR in ./node_modules/react-sticky-box/dist/index.js 3:0-40 Module not found: Error: Can't resolve 'react/jsx-runtime' in '../node_modules/react-sticky-box/dist' Did you mean 'jsx-runtime.js'? BREAKING CHANGE: The request 'react/jsx-runtime' failed to resolve only because it was resolved as fully specified (probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"'). The extension in the request is mandatory for it to be fully specified. Add the extension to the request.

I am using a sample from the demo site:
import StickyBox from "react-sticky-box"; <StickyBox offsetTop={90} offsetBottom={90}><div>Test</div></StickyBox>

@christopher-becker
Copy link
Author

In the file:
node_modules/react-sticky-box/dist/index.js

If I change this line
import { jsx } from "react/jsx-runtime";

To:
import { jsx } from "react/jsx-runtime.js";

Everything works. Obviously this is not ideal.

@bmroot
Copy link

bmroot commented Mar 12, 2023

+1 having the same issue

@danielberndt
Copy link
Collaborator

What bundling system do you use? Vite? Webpack?

@christopher-becker
Copy link
Author

I am using Webpack.

@bmroot
Copy link

bmroot commented Mar 13, 2023

@danielberndt I am using Nextjs 12 webpack 5

@danielberndt
Copy link
Collaborator

I've just released v2.0.2 which should fix this issue

@Emmanuel-umeh
Copy link

i upgraded to the new version but still get same error deploying to vercel

@Emmanuel-umeh
Copy link

downgrading to 2.0.0 worked for me

@danielberndt
Copy link
Collaborator

Yes had to release 2.0.3 to roll back the changes as it was breaking our internal build system as well. Not really sure what exactly to do from here. I was really not expecting that esm would be that complicated for such a simple setup with a single file and pretty much zero dependencies. 😅

@billyen2012
Copy link

if you are using next.js , just do dynamic import with ssr disabled.

const StickyBox = dynamic(() => import('react-sticky-box'), {
  ssr: false,
});

@wangdiee
Copy link

this doesn't work for me.

@xartv
Copy link

xartv commented Nov 22, 2023

Hi! Is there any solution to the problem? I'm getting a similar error with Webpack. I tried different versions 2.0.0 - 2.0.5, it didn’t help.

upd. Downgrading to 1.0.2 helped.

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

7 participants