-
-
Notifications
You must be signed in to change notification settings - Fork 397
Closed
Description
Description
After upgrading Sonner from v2.0.3 to v2.0.4, the build fails with the following error:
Cannot find module 'sonner/dist/styles.css?url'
Prior to this release, importing styles worked correctly. It appears that the path or packaging of the CSS file was changed in v2.0.4.
It seems likely that the new release either removed or relocated dist/styles.css, but the documentation (and/or code) still expects to import it from sonner/dist/styles.css?url.
To Reproduce
-
In your project, update
package.jsonto use:"dependencies": { "sonner": "2.0.4", /* ...other dependencies... */ }
-
Run your package manager to install the new version:
npm install # or yarn install -
In your application code, import the styles exactly as before. For example:
import { Toaster } from "sonner"; import "sonner/dist/styles.css?url";
or
import sonnerStyles from 'sonner/dist/styles.css?url';-
Start the dev server or build your application:
npm run dev # or yarn dev # or however you build
-
Observe the error in the console/terminal:
Cannot find module 'sonner/dist/styles.css?url'
Expected Behavior
- The CSS file should still be available at the same path (
sonner/dist/styles.css) so that importing it using the?urlsuffix works as before. - After upgrading, no import-related errors should occur, and the toast component should continue rendering with the correct default styling.
Actual Behavior
- The import of
sonner/dist/styles.css?urlfails because the file is not found in the publisheddist/directory of the 2.0.4 package. - As a result, the application build crashes, preventing usage of the Sonner Toaster and any related styling.
dotamir, rockey2020, molvqingtai, irina-baeva and sos0molvqingtai
Metadata
Metadata
Assignees
Labels
No labels