Installing the Switch component causes multiple errors with react/jsx-runtime #4298
ItsMeJules
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I tried installing the Switch component and when I started using it I got multiple errors in connection with react/jsx-runtime and radix-ui.
These are the errors I get. I am also using the Checkbox component and everything works fine.
Errors
```ERROR in ./node_modules/@radix-ui/react-switch/dist/index.mjs 11:0-46 Module not found: Error: Can't resolve 'react/jsx-runtime' in '/Users/jules/Documents/backoffice/tb-app-backoffice/node_modules/@radix-ui/react-switch/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. @ ./src/shadcn/components/ui/switch.tsx 5:0-59 13:30-51 17:35-57 31:21-54 @ ./src/pages/quiz/QuizPage.tsx 13:0-59 73:39-45 @ ./src/App.tsx 29:0-49 177:31-39 @ ./src/index.tsx 6:0-24 13:35-38ERROR in ./node_modules/@radix-ui/react-switch/node_modules/@radix-ui/react-context/dist/index.mjs 3:0-40
Module not found: Error: Can't resolve 'react/jsx-runtime' in '/Users/jules/Documents/backoffice/tb-app-backoffice/node_modules/@radix-ui/react-switch/node_modules/@radix-ui/react-context/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.
@ ./node_modules/@radix-ui/react-switch/dist/index.mjs 6:0-61 13:47-65
@ ./src/shadcn/components/ui/switch.tsx 5:0-59 13:30-51 17:35-57 31:21-54
@ ./src/pages/quiz/QuizPage.tsx 13:0-59 73:39-45
@ ./src/App.tsx 29:0-49 177:31-39
@ ./src/index.tsx 6:0-24 13:35-38
ERROR in ./node_modules/@radix-ui/react-switch/node_modules/@radix-ui/react-primitive/dist/index.mjs 5:0-40
Module not found: Error: Can't resolve 'react/jsx-runtime' in '/Users/jules/Documents/backoffice/tb-app-backoffice/node_modules/@radix-ui/react-switch/node_modules/@radix-ui/react-primitive/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.
@ ./node_modules/@radix-ui/react-switch/dist/index.mjs 10:0-54 40:34-50 81:28-42
@ ./src/shadcn/components/ui/switch.tsx 5:0-59 13:30-51 17:35-57 31:21-54
@ ./src/pages/quiz/QuizPage.tsx 13:0-59 73:39-45
@ ./src/App.tsx 29:0-49 177:31-39
@ ./src/index.tsx 6:0-24 13:35-38
ERROR in ./node_modules/@radix-ui/react-switch/node_modules/@radix-ui/react-slot/dist/index.mjs 4:0-50
Module not found: Error: Can't resolve 'react/jsx-runtime' in '/Users/jules/Documents/backoffice/tb-app-backoffice/node_modules/@radix-ui/react-switch/node_modules/@radix-ui/react-slot/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.
@ ./node_modules/@radix-ui/react-switch/node_modules/@radix-ui/react-primitive/dist/index.mjs 4:0-44 13:27-31
@ ./node_modules/@radix-ui/react-switch/dist/index.mjs 10:0-54 40:34-50 81:28-42
@ ./src/shadcn/components/ui/switch.tsx 5:0-59 13:30-51 17:35-57 31:21-54
@ ./src/pages/quiz/QuizPage.tsx 13:0-59 73:39-45
@ ./src/App.tsx 29:0-49 177:31-39
@ ./src/index.tsx 6:0-24 13:35-38```
I also tried deleting and reinstalling node_modules. With no success.
Beta Was this translation helpful? Give feedback.
All reactions