Skip to content

Commit

Permalink
add note about ESM vs CJS outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
JReinhold committed Nov 8, 2023
1 parent 72acb34 commit 45a52d6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -86,6 +86,8 @@ You can define which modules match which environments in the [`package.json#bund
- `managerEntries` is a list of module entries meant only for the manager UI. These modules will be bundled to ESM and won't include types since they are mostly loaded by Storybook directly.
- `previewEntries` is a list of module entries meant only for the preview UI. These modules will be bundled to ESM and won't include types since they are mostly loaded by Storybook directly.

Manager and preview entries are only used in the browser so they only output ESM modules. Export entries could be used both in the browser and in Node depending on their use case, so they both output ESM and CJS modules.

#### Globalized packages

Storybook provides a predefined set of packages that are available in the manager UI and the preview UI. In the final bundle of your addon, these packages should not be included. Instead, the imports should stay in place, allowing Storybook to replace those imports with the actual packages during the Storybook build process.
Expand Down

0 comments on commit 45a52d6

Please sign in to comment.