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

Clean up babelModeV7 migration and code #20117

Merged
merged 1 commit into from
Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@
- [start-storybook / build-storybook binaries removed](#start-storybook--build-storybook-binaries-removed)
- [storyStoreV7 enabled by default](#storystorev7-enabled-by-default)
- [Webpack4 support discontinued](#webpack4-support-discontinued)
- [Modern ESM / IE11 support discontinued](#modern-esm--ie11-support-discontinued)
- [Framework field mandatory](#framework-field-mandatory)
- [frameworkOptions renamed](#frameworkoptions-renamed)
- [Framework standalone build moved](#framework-standalone-build-moved)
- [Docs modern inline rendering by default](#docs-modern-inline-rendering-by-default)
- [Babel mode v7 by default](#babel-mode-v7-by-default)
- [Babel mode v7 exclusively](#babel-mode-v7-exclusively)
- [7.0 feature flags removed](#70-feature-flags-removed)
- [CLI option `--use-npm` deprecated](#cli-option---use-npm-deprecated)
- [Vite builder uses vite config automatically](#vite-builder-uses-vite-config-automatically)
Expand Down Expand Up @@ -474,10 +473,6 @@ To upgrade:

During the 7.0 dev cycle we will be updating this section with useful resources as we run across them.

#### Modern ESM / IE11 support discontinued

SB7.0 compiles to modern ESM, meaning that IE11 is no longer supported. Over the course of the 7.0 dev cycle we will create recommendations for users who still require IE support.

#### Framework field mandatory

In 6.4 we introduced a new `main.js` field called [`framework`](#mainjs-framework-field). Starting in 7.0, this field is mandatory.
Expand Down Expand Up @@ -550,18 +545,18 @@ module.exports = {
};
```

#### Babel mode v7 by default
#### Babel mode v7 exclusively

Storybook now uses your project babel configuration differently as [described below in Babel Mode v7](#babel-mode-v7). This is now the default. To opt-out:
Storybook now uses [Babel mode v7](#babel-mode-v7) exclusively. In 6.x, Storybook provided its own babel settings out of the box. Now, Storybook's uses your project's babel settings (`.babelrc`, `babel.config.js`, etc.) instead.

```js
module.exports = {
features: {
babelModeV7: false,
},
};
In the new mode, Storybook expects you to provide a configuration file. If you want a configuration file that's equivalent to the 6.x default, you can run the following command in your project directory:

```sh
npx sb@next babelrc
```

This will create a `.babelrc.json` file. This file includes a bunch of babel plugins, so you may need to add new package devDependencies accordingly.

#### 7.0 feature flags removed

Storybook uses temporary feature flags to opt-in to future breaking changes or opt-in to legacy behaviors. For example:
Expand Down
1 change: 0 additions & 1 deletion code/lib/core-server/src/dev-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ async function getStoryIndexGenerator(
storyStoreV7?: boolean;
breakingChangesV7?: boolean;
interactionsDebugger?: boolean;
babelModeV7?: boolean;
argTypeTargetsV7?: boolean;
warnOnLegacyHierarchySeparator?: boolean;
},
Expand Down
1 change: 0 additions & 1 deletion code/lib/core-server/src/presets/common-preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ export const features = async (
storyStoreV7: true,
breakingChangesV7: true,
interactionsDebugger: false,
babelModeV7: true,
argTypeTargetsV7: true,
});

Expand Down
5 changes: 0 additions & 5 deletions code/lib/types/src/modules/core-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,6 @@ export interface StorybookConfig {
*/
interactionsDebugger?: boolean;

/**
* Use Storybook 7.0 babel config scheme
*/
babelModeV7?: boolean;

/**
* Filter args with a "target" on the type from the render function (EXPERIMENTAL)
*/
Expand Down
1 change: 0 additions & 1 deletion test-storybooks/external-docs/.storybook/main.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const config = {
features: {
storyStoreV7: !global.navigator?.userAgent?.match?.('jsdom'),
buildStoriesJson: true,
babelModeV7: true,
warnOnLegacyHierarchySeparator: false,
previewMdx2: true,
},
Expand Down