Add Babel migration note to addon migration guide#25660
Conversation
jonniebigodes
left a comment
There was a problem hiding this comment.
@shilman, just a couple of minor tweaks, and this should be good to go, appreciate you taking the time to add this to the addon migration guide. Appreciate it 🙏
|
|
||
| ### Babel-loader removed from Webpack | ||
|
|
||
| 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 in SB8). |
There was a problem hiding this comment.
@shilman are you ok with adjusting this to be:
"Storybook 8 removes babel-loader from the webpack5 builder. 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)."
| As a workaround, your 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: | ||
|
|
||
| ```sh | ||
| npx storybook@latest add @storybook/addon-webpack-compiler-babel | ||
| ``` |
There was a problem hiding this comment.
@shilman minor typo here; there is an extra your, turning this into:
"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:
"
Also, the package's name is incorrect, it should be @storybook/addon-webpack5-compiler-babel
|
|
||
| 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 in SB8). | ||
|
|
||
| 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. |
There was a problem hiding this comment.
@shilman capitalize Babel here if you wouldn't mind, turning this into :
"To solve for both Babel and SWC, the most robust approach is to create an 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."
No description provided.