Open pranavgoel29 opened 12 months ago
Can you provide a demo with a reproduction?
Hi, I actually was struggling with a similar issue today. I think is just an issue with older create-react-app
projects, which has trouble interpreting the exports
field as seen here.
This issue is can be resolved by adding:
"main": "./dist/index.js",
"module": "./dist/index.mjs",
back to package.json
. These were removed in #136.
It would be great if these fields could be added back to support older apps.
I have updated the react version to 18 as well, still facing the same issue.
@cyu2019 Thanks for pointing these, I tried after changing exports back to
And it worked.
I have also tried the following format, it is working.
"type": "module",
"exports": "./dist/index.js",
"types": "./dist/index.d.ts",
Same issue here.
This issue is can be resolved by adding:
"main": "./dist/index.js", "module": "./dist/index.mjs",
back to
package.json
. These were removed in #136.It would be great if these fields could be added back to support older apps.
I second that. Found the same issue in a vite
(v4) app today.
Otherwise eslint
is reporting:
error Unable to resolve path to module 'sonner' import/no-unresolved
As a fix import it like this
import { Toaster } from 'sonner/dist';
Same issue as @konstantinkreft in a Vite 5.2.7
app. ~Importing from sonner/dist
makes eslint not complaining.~
Same issue, and importing from 'sonner/dist'
doesn't work either.
Same issue here.
For me, installing direcly from npm, the entry "main": "./dist/index.mjs"
does not appear.
When adding manually, the error disappears
w11 / node 20.16.0 / npm 10.8.1 / sonner 1.5.0