Skip to content

Config overlay #11076

Description

@lmeyerov

Is your proposal related to a problem?

We try to run unejected to simplify maintenance over multiple CRA's in our monorepo, but one of the main reasons we cannot is because of slight tweaks to webpack.config.js (ex: #9712, #11075) . The current recommended workaround of running a git-fork-per-module defeats much of the point of monorepos and libraries, so we're exploring improving CRA.

Describe the solution you'd like

Build systems like docker-compose provide overlay/transformer mechanisms, with ideas like:

  • webpack.config.js automatically overlays webpack.config.override.js: super simple cases
  • webpack.config.js manually overlays via a flag like -f custom1.js -f custom2.js: needed when we are doing different build targets
  • json files get deep merged additively; js files are transforms (+ may do their own imports, e.g., plugins)

Some webpack libraries already look at some of these options, e.g., https://github.com/survivejs/webpack-merge

Describe alternatives you've considered

The current practice is ad-hoc promotion of some webpack fields to env vars, leading to whackamole issues like the above linked ones

Additional context

We found most of our ejected CRAs come down to a few fairly tiny and largely predictable edits. The webpack.config.js ones are slightly more interesting due to the use of plugins and them+webpack being a bit of a moving target.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions