Storybook: Update default path to webpack.config.js according to the latest [email protected]

Created on 24 Dec 2018  路  5Comments  路  Source: storybookjs/storybook

Describe the bug
Getter of default webpack config is broken. require.resolve throws an error if a file doesn't exist.
Try to wrap it into try...catch block or just remove it.

https://github.com/storybooks/storybook/blob/next/app/react/src/server/cra-config.js#L87

To Reproduce
Steps to reproduce the behaviour:

  1. Create react app with latest CRA with [email protected]
  2. Add [email protected]
  3. Run npm run storybook
  4. You will see an error Cannot find module: webpack.config.dev

Expected behaviour
No error

System:

  • OS: MacOS
  • Device: Macbook Pro 2017
  • Framework: react
  • Version: 4.1.2
bug cra

Most helpful comment

Hurrah!! I just released https://github.com/storybooks/storybook/releases/tag/v4.1.4 containing PR #5074 that references this issue. Upgrade today to try it out!

All 5 comments

I've discovered that create-react-app now using [email protected] where they merged webpack.config.dev.js and webpack.config.prod.js into single file webpack.config.js

https://github.com/facebook/create-react-app/commit/30ee52cf3b2cbb6ac70999c02b1196bcaba8d4ca#diff-ee7ca784a2ec9d96668503d6394bdd62

Thanks @appbak3r. In the interim, you can downgrade to [email protected] while we resolve this.

We, the CRA team, made this change a while ago, and @igor-dv made a fix for this, but there was a small bug which is what my PR aims to resolve.

w00t!! I just released https://github.com/storybooks/storybook/releases/tag/v4.2.0-alpha.7 containing PR #5074 that references this issue. Upgrade today to try it out!

Because it's a pre-release you can find it on the @next NPM tag.

Closing this issue. Please re-open if you think there's still more to do.

Hurrah!! I just released https://github.com/storybooks/storybook/releases/tag/v4.1.4 containing PR #5074 that references this issue. Upgrade today to try it out!

In case someone else comes here having problems with the latest storybook combined with react-scripts < 2.1.2 on windows, @simonbuchan pointed out in the PR that this fix is incompatible with the aforementioned combination, but simply upgrading react-scripts should fix your problem.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wahengchang picture wahengchang  路  3Comments

dnlsandiego picture dnlsandiego  路  3Comments

tlrobinson picture tlrobinson  路  3Comments

tirli picture tirli  路  3Comments

miljan-aleksic picture miljan-aleksic  路  3Comments