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

Core: Fix package duplication issues by aliasing all storybook packages #11092

Merged
merged 11 commits into from
Jun 11, 2020

Conversation

ndelangen
Copy link
Member

Issue: #10887

What I did

I added aliases for all storybook related packages for the preview

@ndelangen ndelangen added this to the 6.0 milestone Jun 9, 2020
@ndelangen ndelangen requested review from shilman and gaetanmaisse June 9, 2020 09:05
@ndelangen ndelangen self-assigned this Jun 9, 2020
@@ -21,6 +23,29 @@ import { toRequireContextString } from './to-require-context';
import { useBaseTsSupport } from '../config/useBaseTsSupport';

const reactPaths = {};
const storybookPaths = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const storybookPaths = ['addons', ...other ].reduce((paths,package) => ({
   ...paths, 
   [`@storybook/${package}`]: path.dirname(resolveFrom(__dirname, `@storybook/${package}/package.json`))`
}), {});

Would reduce boilerplate a bit :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes please 🙏

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you wish 🎩

lib/core/src/server/preview/iframe-webpack.config.js Outdated Show resolved Hide resolved
@ndelangen ndelangen requested a review from usulpro as a code owner June 9, 2020 13:12
@shilman shilman changed the title fix #10887 by aliasing all storybook packages Core: Fix package duplication issues by aliasing all storybook packages Jun 9, 2020
@ndelangen
Copy link
Member Author

@gaetanmaisse @tooppaaa @shilman @mrmckeb want to review this? 🙇

Copy link
Member

@gaetanmaisse gaetanmaisse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To tell the truth, it's a bit mysterious for me, it LGTM ✅ but I'm not confident enough to click the "Approve" button 😛

'client-api',
'client-logger',
].reduce(
(acc, package) => ({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

package is not a valid variable name in JS 😉 => sbPackage

@@ -52,7 +52,9 @@
"@babel/register": "^7.8.3",
"@storybook/addons": "6.0.0-beta.23",
"@storybook/api": "6.0.0-beta.23",
"@storybook/channels": "6.0.0-beta.23",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are added to be sure to have them and be able to have a working alias?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah all packages of @storybook/* that are conceivably used are aliased here so that there can only 1 of them in the entire bundle.

Copy link
Member

@mrmckeb mrmckeb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

# Conflicts:
#	examples/cra-kitchen-sink/.storybook/main.js
@ndelangen ndelangen merged commit 4937b3f into next Jun 11, 2020
@ndelangen ndelangen deleted the fix/10887 branch June 11, 2020 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants