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

create-react-app config is loading twice #4903

Closed
mrmckeb opened this issue Dec 2, 2018 · 2 comments
Closed

create-react-app config is loading twice #4903

mrmckeb opened this issue Dec 2, 2018 · 2 comments

Comments

@mrmckeb
Copy link
Member

mrmckeb commented Dec 2, 2018

Describe the bug
The create-react-app config is loading twice, but should not be.

To Reproduce
Steps to reproduce the behavior:

  1. Run storybook alongside an application based on create-react-app.
  2. Observe terminal output.

Expected behavior
This config should be loaded once only.

Screenshots
image

System:

  • OS: Windows 10 - Ubuntu on WSL
  • Device: Surface Book 2
  • Browser: N/A
  • Framework: React
  • Addons: a11y, actions, knobs, links
  • Version: 4.1.0-alpha.8

Additional context
I discovered this whilst working on #4902, as I was getting a strange error and then discovered that the config was loading twice. I've worked around this issue on that branch, for now, and commented so that line can be remove when this issue is resolved.

@igor-dv
Copy link
Member

igor-dv commented Dec 2, 2018

As I've mentioned here - #4902 (comment)

We are applying presets on baseConfig and defaultConfig independently (it's not an issue introduced only in presets feature, it was also before, but now it's more visible):

module.exports = (baseConfig, mode, defaultConfig) => { /*...*/ }

The reason for this, is that we don't know what user will choose.

The possible solution could be:

Changing them into funcs:

module.exports = (baseConfig, mode, defaultConfig) => {
  const config = baseConfig(); // let's say the presets will be applyed only upon the invocation.
}

☝️ this can be backward compatible with a deprecation message.
Update: ☝️ this is also a breaking change 🤔

Reducing the baseConfig at all (my prefered actually)

The difference between the base and default configs are only a few css/images rules added by default. IMO this is more a historical setup, and we can just use only one. Also, since we are trying to make things work out of the box with the tools like CRA and angular-cli (and more in the future).

So it could be like this:

module.exports = (config, mode) => { /* ... */ }

☝️ this is a breaking change

@igor-dv
Copy link
Member

igor-dv commented Dec 25, 2018

Will be a part of the v5

@igor-dv igor-dv closed this as completed Dec 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants