Skip to content

Commit 4e1f962

Browse files
authored
Merge pull request #25618 from storybookjs/vy/addon-migration-guide-8
2 parents 5bf7526 + 7961cb1 commit 4e1f962

File tree

1 file changed

+27
-38
lines changed

1 file changed

+27
-38
lines changed

docs/addons/addon-migration-guide.md

+27-38
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,66 @@
11
---
2-
title: Addon migration guide for Storybook 7.0
2+
title: Addon migration guide for Storybook 8.0
33
---
44

5-
Storybook 7 is our first major release in over two years. While Storybook’s addon API has not changed much in the past couple of years, addons require several changes for compatibility with Storybook 7. This guide will walk you through the upgrade process.
5+
We deeply appreciate the dedication and effort addon creators put into keeping the Storybook ecosystem vibrant and up-to-date. As Storybook evolves to version 8.0, bringing new features and improvements, this guide is here to assist you in migrating your addons from 7.x to 8.0. If you need to migrate your addon from an earlier version of Storybook, please first refer to the [Addon migration guide for Storybook 7.0](https://storybook.js.org/docs/7.6/addons/addon-migration-guide).
66

77
<Callout variant="info">
88

99
As we gather feedback from the community, we’ll update this page. We also have a general [Storybook migration guide](../migration-guide.md) if you’re looking for that.
1010

1111
</Callout>
1212

13-
## Dependencies
13+
## Updating dependencies
1414

15-
The first thing to do is upgrade any Storybook dependencies in your project. We release the next version of all our packages on the `next` npm tag, so the easiest thing is to reference that in your `package.json`:
15+
Begin by updating your Storybook dependencies. Use the `next` tag for pre-release versions, `latest` for the most recent stable release, or specify the version directly.
1616

1717
```json
1818
{
1919
"dependencies": {
20-
"@storybook/client-logger": "next"
20+
"@storybook/client-logger": "next" // or "latest", or "^8.0.0"
2121
}
2222
}
2323
```
2424

25-
If you'd rather depend on the latest version of Storybook, you can use the `latest` tag:
25+
## Key changes for addons
2626

27-
```json
28-
{
29-
"dependencies": {
30-
"@storybook/client-logger": "latest"
31-
}
32-
}
33-
```
27+
Here are the essential changes in version 8.0 that impact addon development. Please check the [full migration note](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#from-version-7x-to-800) for an exhaustive list of changes in 8.0.
3428

35-
Or use a version specifier:
29+
### Node.js 16 support dropped
3630

37-
```json
38-
{
39-
"dependencies": {
40-
"@storybook/client-logger": "^7.0.0"
41-
}
42-
}
43-
```
31+
Please upgrade your addon to Node.js 18, as support for Node.js 16 has ended.
4432

45-
## Breaking changes
33+
### React 18 for manager UI
4634

47-
### `@storybook/addons` has been split into `@storybook/manager-api` and `@storybook/preview-api`
35+
UI injected into panels, tools, etc. by addons is now rendered with React 18. Also note that the `key` prop is no longer passed to the render function.
4836

49-
The default export from `@storybook/addons` can now be used via named imports from `@storybook/manager-api` and `@storybook/preview-api`, depending on which environment you need the API from. The manager is the Storybook UI and includes your addon's Addon Panel. While the preview is used to render stories and includes your addon's decorators.
37+
### @storybook/components deprecations
5038

51-
You might also depend (and use) these packages in your addon's decorators: `@storybook/store`, `@storybook/preview-web`, `@storybook/core-client`, `@storybook/client-api`. These have all been consolidated into `@storybook/preview-api`. If you use any of these packages, please import what you need from `@storybook/preview-api` instead.
39+
`Icons` component from `@storybook/components` is now deprecated in favor of [`@storybook/icons`](https://github.com/storybookjs/icons). Additionally, various `Button` component props are also deprecated, with alternatives provided.
5240

53-
### Some components were moved from `@storybook/components` to a new package `@storybook/blocks`
41+
### Storybook layout state API changes
5442

55-
Components like `ColorControl`, `ColorPalette`, `ArgsTable`, `ArgRow`, `TabbedArgsTable`, `SectionRow`, `Source`, AND `Code` were moved into a new package. In Storybook 7.0, they should be imported from `@storybook/blocks` instead.
43+
If you're customizing the Storybook UI configuration with `addons.setConfig({...})`, be aware of [the changes to the layout state API](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#ui-layout-state-has-changed-shape).
5644

57-
```js
58-
// import { ColorControl } from '@storybook/components';
59-
import { ColorControl } from '@storybook/blocks';
60-
```
45+
### Removal of deprecated features
6146

62-
## Deprecations and detailed migrations
47+
Deprecated packages and APIs from 7.0 are now removed in 8.0.Consult the [full migration notes](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#deprecations-which-are-now-removed) for details. Most notably for addons, the removal of the `@storybook/addons` now necessitates a switch to `@storybook/preview-api` and `@storybook/manager-api`.
6348

64-
We’ve also deprecated a few packages and APIs in 7.0. After you’ve made your addon working with 7.0, make sure to check the browser console in a Storybook running your addon. If you’re using deprecated packages, you should see warnings that link to migration instructions.
49+
### Babel-loader removed from webpack
6550

66-
There are more technical details available in the [migration notes for addon authors](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#specific-instructions-for-addon-creators).
51+
Storybook 8 [removes babel-loader from the webpack5 builder](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#removed-babelcore-and-babel-loader-from-storybookbuilder-webpack5). If your addon's preset overrides the `babel()` method, it will break if your users are using SWC to compile their files (which is the new default for Webpack 5-based Storybook projects).
6752

68-
Finally, for an exhaustive list of noteworthy changes in 7.0, check [the full migration notes](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#from-version-65x-to-700).
53+
To solve for both Babel and SWC, the most robust approach is to create an [unplugin](https://github.com/unjs/unplugin) that will work with both Webpack and Vite builders. That will give you full control to run Babel (or whatever you want) on stories and components as they are loaded.
6954

70-
## Releasing
55+
As a workaround, update your documentation to tell users to opt-in to Babel support. This should fix your addon in their project, at the cost of performance:
56+
57+
```sh
58+
npx storybook@latest add @storybook/addon-webpack5-compiler-babel
59+
```
7160

72-
You should release a new major version of this addon that supports Storybook 7. If you want to continue making changes that support Storybook 6, you should release a minor or a patch of the previous major version.
61+
## Releasing
7362

74-
We also recommend releasing your own addon using the `next` tag to test it out in projects.
63+
Release a new major version of your addon for Storybook 8.0. We recommend you to continue supporting 7.x with minor or patch versions. We also recommend releasing your own addon using the `next` tag to test it out in projects.
7564

7665
## Support
7766

0 commit comments

Comments
 (0)