Is there a way to prevent load of react-scripts for webpack.config.js?
See original GitHub issueIs your feature request related to a problem? Please describe.
I have a custom config for storybook using the full-control mode. I now have a sibling package in a lerna
monorepo that uses react-scripts
, but this is not used or wanted in my storybook package, and I’d like to avoid loading this config for storybook at all, as the rules conflict and I need much more control over the storybook config than what react-scripts
offers for this use-case. React-scripts is being hoisted by lerna
into the root node_modules
directory, which results in this config being loaded for use when running the storybook
and build-storybook
scripts. From what I understand, this is because it is found in the root node_modules
.
Describe the solution you’d like
I would either like a way to disable the load of react-scripts config completely—perhaps a cli flag or a way to get and extend only the base minimum config used for storybook in webpack.config.js
(before all the config is added by react-scripts).
Describe alternatives you’ve considered
I considered preventing react-scripts
from being hoisted to the root node_modules
, but this isn’t a good option because it has the potential to be used by many other leaf packages that could be added to this monorepo and therefore would be best held in the root n_m
.
Are you able to assist bring the feature to reality?
I’m writing this in hopes there is already a supported way to achieve my goal without having to take the storybookBaseConfig in webpack.config.js
and do a lot of tedious filtering of the rules that are being added from react-scripts
. It would be a much cleaner solution to simply prevent the load of react-scripts
from the start. If there is no way currently for this to be done, maybe we can talk about some options and the best way forward for a potential new feature.
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (6 by maintainers)
Top GitHub Comments
@mrmckeb for a little color here, we’ve already started adding presets for scss and typescript, and it seems to be working well.
I can imagine doing the same for CRA compat. We’d automatically add it to the user’s
presets.js
file if CRA is detected by the CLI, and if it didn’t get detected users could add it manually (and could potentially configure it also–something that’s not possible right now).This is a breaking change, so we wouldn’t be able to introduce it until 6.0. But I think we should consider it!
I’ve run across this too. Perhaps we can do a check in
package.json
instead of or in addition to the existing check. What do you think @mrmckeb ?