Skip to content

Error: The package path ./dist/react-datepicker.css is not exported from package.json in Storybook. #5835

@Aluisio

Description

@Aluisio

A clear and concise description of what the bug is.

After updating Storybook to version 9.1.2, when running the npm run storybook command, I'm getting the error:
Module not found: Error: Package path ./dist/react-datepicker.css is not exported from package.json

My project has the following packages installed:

@storybook/addon-docs": "^9.1.3,
@storybook/addon-links": "^9.1.3,
@storybook/nextjs": "^9.1.3,
storybook": "^9.1.3

Apparently the error is related to the @storybook/nextjs package, because if I revert to the @storybook/nextjs:9.1.1 package version, Storybook works again.

analyzing the exports section of package.json, the export configuration appears to be invalid for the syntax:

"exports": {
    ".": {
      "import": {
        "types": "./dist/index.d.ts",
        "default": "./dist/index.es.js"
      },
      "require": {
        "types": "./dist/index.d.ts",
        "default": "./dist/index.js"
      }
    },
    "./dist/*.css": "./dist/*.css",
    "./src/stylesheets/*.scss": "./src/stylesheets/*.scss"
  },

Analyzing the exports section of package.json, the export configuration appears to be invalid for the syntax.

Changing it to "./dist/*": "./dist/*" makes Storybook work again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions