Sorry if this was discussed before, I tried searching the issues and didn't find any match.
There are not so many differences between the webpack configs (dev / prod) and I have the working example (https://gist.github.com/emirotin/4ee74e426b20055e418a0101d754f8be) where they're merged into a single factory.
Then the entry configs just look like:
const getConfig = require('./webpack-config');
module.exports = getConfig(false);
If this is interesting I can send a PR.
Why is it useful?
On a regular basis, I have to eject because I need TS support. This means at least adding a loader (same for dev and prod) and updating the list of extensions.
Quite often I also want to play a bit with some plugins configuration and then need to replicate these changes in prod config.
If you just want to add typescript you could use https://github.com/wmonk/create-react-app-typescript
TS is just an example, obv it can be CSS modules, or other modifications that apply to both dev and prod
I am generally supporting of migrating to Webpack 2's env feature for this.
Do you mean https://webpack.js.org/guides/environment-variables/ (which is basically my current approach, but with NODE_ENV detection instead of separate entry files) or something
like https://github.com/survivejs/webpack-merge?
I mean this: https://webpack.js.org/guides/migrating/#using-custom-arguments-in-cli-and-configuration. Although now that I think of it, it won't really help because we don't use the CLI. But maybe we can use the same format: one webpack.config.js that exports a function taking env.
Then it's basically just the same thing I have (see the gist in the issue
body)?
On Fri, Jun 23, 2017 at 5:35 PM Dan Abramov notifications@github.com
wrote:
I mean this:
https://webpack.js.org/guides/migrating/#using-custom-arguments-in-cli-and-configuration.
Although now that I think of it, it won't really help because we don't use
the CLI. But maybe we can use the same format: one webpack.config.js that
exports a function taking env.—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/facebookincubator/create-react-app/issues/2525#issuecomment-310681969,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAgGCAf-Tbxvd1LwUfBxBfAsExYSp_vYks5sG80lgaJpZM4N4R7y
.
Yep, same thing.
So want me to PR it? Can do tonight
On Mon, Jun 26, 2017 at 9:45 PM Dan Abramov notifications@github.com
wrote:
Yep, same thing.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/facebookincubator/create-react-app/issues/2525#issuecomment-311147209,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAgGCEb9s5IW2YCHnGQoeHlvYjY7MiAxks5sH_xWgaJpZM4N4R7y
.
Love to see this. We don't want to maintain ejected things (really hard), but a flexible way to add some customize configurations.
@vinhlh This is not what this issue was about.
I'll close as stale.
Most helpful comment
TS is just an example, obv it can be CSS modules, or other modifications that apply to both dev and prod