From 236c5acedbf9a6f859a4da549ce6c1b0690d0a82 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Fri, 26 Jul 2019 18:43:11 +0800 Subject: [PATCH] Core: Remove project root `babel.config.js` loading --- MIGRATION.md | 127 ++++++++++-------- .../server/utils/load-custom-babel-config.js | 6 +- 2 files changed, 72 insertions(+), 61 deletions(-) diff --git a/MIGRATION.md b/MIGRATION.md index e61987b01e96..ac0eb40ddf7e 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -1,66 +1,69 @@ # Migration -- [Migration](#Migration) - - [From version 5.1.x to 5.2.x](#From-version-51x-to-52x) - - [Docs mode docgen](#Docs-mode-docgen) - - [storySort option](#storySort-option) - - [From version 5.0.x to 5.1.x](#From-version-50x-to-51x) - - [React native server](#React-native-server) - - [Angular 7](#Angular-7) - - [CoreJS 3](#CoreJS-3) - - [From version 5.0.1 to 5.0.2](#From-version-501-to-502) - - [Deprecate webpack extend mode](#Deprecate-webpack-extend-mode) - - [From version 4.1.x to 5.0.x](#From-version-41x-to-50x) - - [sortStoriesByKind](#sortStoriesByKind) - - [Webpack config simplification](#Webpack-config-simplification) - - [Theming overhaul](#Theming-overhaul) - - [Story hierarchy defaults](#Story-hierarchy-defaults) - - [Options addon deprecated](#Options-addon-deprecated) - - [Individual story decorators](#Individual-story-decorators) - - [Addon backgrounds uses parameters](#Addon-backgrounds-uses-parameters) - - [Addon cssresources name attribute renamed](#Addon-cssresources-name-attribute-renamed) - - [Addon viewport uses parameters](#Addon-viewport-uses-parameters) - - [Addon a11y uses parameters, decorator renamed](#Addon-a11y-uses-parameters-decorator-renamed) - - [New keyboard shortcuts defaults](#New-keyboard-shortcuts-defaults) - - [New URL structure](#New-URL-structure) - - [Rename of the `--secure` cli parameter to `--https`](#Rename-of-the---secure-cli-parameter-to---https) - - [Vue integration](#Vue-integration) - - [From version 4.0.x to 4.1.x](#From-version-40x-to-41x) - - [Private addon config](#Private-addon-config) - - [React 15.x](#React-15x) - - [From version 3.4.x to 4.0.x](#From-version-34x-to-40x) - - [React 16.3+](#React-163) - - [Generic addons](#Generic-addons) - - [Knobs select ordering](#Knobs-select-ordering) - - [Knobs URL parameters](#Knobs-URL-parameters) - - [Keyboard shortcuts moved](#Keyboard-shortcuts-moved) - - [Removed addWithInfo](#Removed-addWithInfo) - - [Removed RN packager](#Removed-RN-packager) - - [Removed RN addons](#Removed-RN-addons) - - [Storyshots Changes](#Storyshots-Changes) - - [Webpack 4](#Webpack-4) - - [Babel 7](#Babel-7) - - [Create-react-app](#Create-react-app) - - [Upgrade CRA1 to babel 7](#Upgrade-CRA1-to-babel-7) - - [Migrate CRA1 while keeping babel 6](#Migrate-CRA1-while-keeping-babel-6) +- [Migration](#migration) + - [From version 5.1.x to 5.2.x](#from-version-51x-to-52x) + - [Grid toolbar-feature](#grid-toolbar-feature) + - [Docs mode docgen](#docs-mode-docgen) + - [storySort option](#storysort-option) + - [From version 5.1.x to 5.1.10](#from-version-51x-to-5110) + - [babel.config.js support](#babelconfigjs-support) + - [From version 5.0.x to 5.1.x](#from-version-50x-to-51x) + - [React native server](#react-native-server) + - [Angular 7](#angular-7) + - [CoreJS 3](#corejs-3) + - [From version 5.0.1 to 5.0.2](#from-version-501-to-502) + - [Deprecate webpack extend mode](#deprecate-webpack-extend-mode) + - [From version 4.1.x to 5.0.x](#from-version-41x-to-50x) + - [sortStoriesByKind](#sortstoriesbykind) + - [Webpack config simplification](#webpack-config-simplification) + - [Theming overhaul](#theming-overhaul) + - [Story hierarchy defaults](#story-hierarchy-defaults) + - [Options addon deprecated](#options-addon-deprecated) + - [Individual story decorators](#individual-story-decorators) + - [Addon backgrounds uses parameters](#addon-backgrounds-uses-parameters) + - [Addon cssresources name attribute renamed](#addon-cssresources-name-attribute-renamed) + - [Addon viewport uses parameters](#addon-viewport-uses-parameters) + - [Addon a11y uses parameters, decorator renamed](#addon-a11y-uses-parameters-decorator-renamed) + - [New keyboard shortcuts defaults](#new-keyboard-shortcuts-defaults) + - [New URL structure](#new-url-structure) + - [Rename of the `--secure` cli parameter to `--https`](#rename-of-the---secure-cli-parameter-to---https) + - [Vue integration](#vue-integration) + - [From version 4.0.x to 4.1.x](#from-version-40x-to-41x) + - [Private addon config](#private-addon-config) + - [React 15.x](#react-15x) + - [From version 3.4.x to 4.0.x](#from-version-34x-to-40x) + - [React 16.3+](#react-163) + - [Generic addons](#generic-addons) + - [Knobs select ordering](#knobs-select-ordering) + - [Knobs URL parameters](#knobs-url-parameters) + - [Keyboard shortcuts moved](#keyboard-shortcuts-moved) + - [Removed addWithInfo](#removed-addwithinfo) + - [Removed RN packager](#removed-rn-packager) + - [Removed RN addons](#removed-rn-addons) + - [Storyshots Changes](#storyshots-changes) + - [Webpack 4](#webpack-4) + - [Babel 7](#babel-7) + - [Create-react-app](#create-react-app) + - [Upgrade CRA1 to babel 7](#upgrade-cra1-to-babel-7) + - [Migrate CRA1 while keeping babel 6](#migrate-cra1-while-keeping-babel-6) - [start-storybook opens browser](#start-storybook-opens-browser) - - [CLI Rename](#CLI-Rename) - - [Addon story parameters](#Addon-story-parameters) - - [From version 3.3.x to 3.4.x](#From-version-33x-to-34x) - - [From version 3.2.x to 3.3.x](#From-version-32x-to-33x) + - [CLI Rename](#cli-rename) + - [Addon story parameters](#addon-story-parameters) + - [From version 3.3.x to 3.4.x](#from-version-33x-to-34x) + - [From version 3.2.x to 3.3.x](#from-version-32x-to-33x) - [`babel-core` is now a peer dependency (#2494)](#babel-core-is-now-a-peer-dependency-2494) - - [Base webpack config now contains vital plugins (#1775)](#Base-webpack-config-now-contains-vital-plugins-1775) - - [Refactored Knobs](#Refactored-Knobs) - - [From version 3.1.x to 3.2.x](#From-version-31x-to-32x) - - [Moved TypeScript addons definitions](#Moved-TypeScript-addons-definitions) - - [Updated Addons API](#Updated-Addons-API) - - [From version 3.0.x to 3.1.x](#From-version-30x-to-31x) - - [Moved TypeScript definitions](#Moved-TypeScript-definitions) - - [Deprecated head.html](#Deprecated-headhtml) - - [From version 2.x.x to 3.x.x](#From-version-2xx-to-3xx) - - [Webpack upgrade](#Webpack-upgrade) - - [Packages renaming](#Packages-renaming) - - [Deprecated embedded addons](#Deprecated-embedded-addons) + - [Base webpack config now contains vital plugins (#1775)](#base-webpack-config-now-contains-vital-plugins-1775) + - [Refactored Knobs](#refactored-knobs) + - [From version 3.1.x to 3.2.x](#from-version-31x-to-32x) + - [Moved TypeScript addons definitions](#moved-typescript-addons-definitions) + - [Updated Addons API](#updated-addons-api) + - [From version 3.0.x to 3.1.x](#from-version-30x-to-31x) + - [Moved TypeScript definitions](#moved-typescript-definitions) + - [Deprecated head.html](#deprecated-headhtml) + - [From version 2.x.x to 3.x.x](#from-version-2xx-to-3xx) + - [Webpack upgrade](#webpack-upgrade) + - [Packages renaming](#packages-renaming) + - [Deprecated embedded addons](#deprecated-embedded-addons) ## From version 5.1.x to 5.2.x @@ -89,6 +92,12 @@ addParameters({ }); ``` +## From version 5.1.x to 5.1.10 + +### babel.config.js support + +SB 5.1.0 added [support for project root `babel.config.js` files](https://github.com/storybookjs/storybook/pull/6634), which was an [unintentional breaking change](https://github.com/storybookjs/storybook/issues/7058#issuecomment-515398228). 5.1.10 fixes this, but if you relied on project root `babel.config.js` support, this bugfix is a breaking change. The workaround is to copy the file into your `.storybook` config directory. We may add back project-level support in 6.0. + ## From version 5.0.x to 5.1.x ### React native server diff --git a/lib/core/src/server/utils/load-custom-babel-config.js b/lib/core/src/server/utils/load-custom-babel-config.js index 051d8ea1f62f..397fd7a11e81 100644 --- a/lib/core/src/server/utils/load-custom-babel-config.js +++ b/lib/core/src/server/utils/load-custom-babel-config.js @@ -80,10 +80,12 @@ function isBabelLoader8() { } export default async function(configDir, getDefaultConfig) { - const projectRoot = process.cwd(); + // Between versions 5.1.0 - 5.1.9 this loaded babel.config.js from the project + // root, which was an unintentional breaking change. We can add back project support + // in 6.0. const babelConfig = loadFromPath(path.resolve(configDir, '.babelrc')) || - loadFromPath(path.resolve(projectRoot, 'babel.config.js')); + loadFromPath(path.resolve(configDir, 'babel.config.js')); if (babelConfig) { // If the custom config uses babel's `extends` clause, then replace it with