Why do I get an error with exports or imports when building a storybook?
12:27 12 Dec 2025

All folders and files are available here: https://github.com/Altazavr/B-production.

When I try to build Storybook, I get the following error:

npm run storybook:build

Error:

ERR! => Failed to build the preview
ERR! Module not found: Error: "./Counter" is not exported under the conditions ["import","module","webpack","production","browser"] from package C:\Users\User\Desktop\B-production\node_modules\entities (see exports field in C:\Users\User\Desktop\B-production\node_modules\entities\package.json)

Note: ./Counter is a file inside the entities package, and everything looks clean. I don’t understand why this error occurs.

You can also check src/app/providers/StoreProvider/config/store.ts.

To reproduce the issue:

  1. Clone the repo or copy the folder.

  2. Run npm install.

  3. Run npm run storybook:build.

Also, there is a commit before the last one where Storybook worked successfully.

Can anyone help me fix this?

reactjs typescript import export storybook