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

fix(www): update storybook docs to prefer Gatsby ES6 module in webpack config #10669

Merged
merged 1 commit into from
Dec 27, 2018
Merged
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
3 changes: 3 additions & 0 deletions docs/docs/visual-testing-with-storybook.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ module.exports = (baseConfig, env, defaultConfig) => {
require.resolve("@babel/plugin-proposal-class-properties"),
]

// Prefer Gatsby ES6 entrypoint (module) over commonjs (main) entrypoint
defaultConfig.resolve.mainFields = ["browser", "module", "main"]
Copy link
Contributor

@DSchau DSchau Dec 27, 2018

Choose a reason for hiding this comment

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

I'm pretty surprised this isn't the way this already works.

I believe Webpack works this way--and Storybook uses Webpack afaik, so this is odd.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@DSchau The defaultConfig from storybook has mainFields: ['browser', 'main', 'module'],

I think it gets set at https://github.com/storybooks/storybook/blob/0ef3f40d678fb42ca74505e99cc3ad2449c3bfdf/lib/core/src/server/preview/iframe-webpack.config.js#L84

Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder how this will affect other modules outside of gatsby, with that said I think we should make the change to docs still


return defaultConfig
}
```
Expand Down