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

Can't resolve '@emotion/react/jsx-runtime' #3129

Open
kushagra51 opened this issue Nov 26, 2023 · 3 comments
Open

Can't resolve '@emotion/react/jsx-runtime' #3129

kushagra51 opened this issue Nov 26, 2023 · 3 comments

Comments

@kushagra51
Copy link

Current behavior:

Scenario:
I am creating a package which exports react screens, and that package is then consumed by a container react application that consumes the screens and renders them. But I am getting the below error while running the container application.

Can't resolve '@emotion/react/jsx-runtime' in '/Users/test/Desktop/conatiner-app/node_modules/my-package'
Did you mean 'emotion-react-jsx-runtime.browser.esm.js'?
BREAKING CHANGE: The request '@emotion/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.

Note:
The catch here is the error only occurs if I am keeping @emotion/react in peer and devDependencies of the package in order to not include it in the bundle, because I have kept @emotion/react in dependency in the container application.

But if I keep @emotion/react in dependency in my package and as well as in dependency in my container application then it works, but doing this isn't a good idea as I don't want to ship the unnecessary @emotion/react code with my package's bundle.

Bundled code of my package which imports jsx from @emotion/react/jsx-runtime:

Screenshot 2023-11-27 at 1 29 04 AM

Environment information:

  • react version: 17.0.2
  • @emotion/react version: 11.9.3
@yarv-dev
Copy link

Have the same issue, would like a fix

@AfLosada
Copy link

Same issue here

@dondxniel
Copy link

+1

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

No branches or pull requests

4 participants