storybookjs / addon-svelte-csf

[Incubation] CSF using Svelte components.
MIT License
98 stars 29 forks source link

Exports package.json #157

Closed tylergaw closed 7 months ago

tylergaw commented 7 months ago

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.

shilman commented 7 months ago

:rocket: PR was released in v4.0.12 :rocket:

tylergaw commented 7 months ago

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