Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exports package.json #157

Merged
merged 1 commit into from
Nov 17, 2023
Merged

Exports package.json #157

merged 1 commit into from
Nov 17, 2023

Conversation

tylergaw
Copy link
Contributor

@tylergaw tylergaw commented Nov 17, 2023

This adds an entry in package.json to export package.json.

Why?

I'm using addon-svelte-csf in a monorepo where I need to find the absolute path of a package in .storybook/main.js. A simplified version:

addons: [
  dirname(require.resolve(join('@storybook/addon-svelte-csf', 'package.json')))
]

What happens currently?

Without the exported package.json, we hit an error attempting to get it

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package.json' is not defined by "exports"

Is this normal?

I think so. Looking at other official addons, it looks common to export package.json. Examples:

Again, this seems OK to do, but I am a little hazy on how the exports setup is supposed to work, so this may not be the right way to do this.

@tylergaw tylergaw marked this pull request as ready for review November 17, 2023 03:46
@JReinhold JReinhold added enhancement New feature or request patch Increment the patch version when merged labels Nov 17, 2023
Copy link
Collaborator

@JReinhold JReinhold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good!

@JReinhold JReinhold merged commit f8aab06 into storybookjs:main Nov 17, 2023
2 checks passed
@shilman
Copy link
Member

shilman commented Nov 17, 2023

🚀 PR was released in v4.0.12 🚀

@shilman shilman added the released This issue/pull request has been released. label Nov 17, 2023
@tylergaw tylergaw deleted the patch-1 branch November 17, 2023 15:25
@tylergaw
Copy link
Contributor Author

Excellent, thanks for the fast turnaround @JReinhold @shilman!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request patch Increment the patch version when merged released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants