Figure out multiple configs passed to compiler
See original GitHub issueCurrently we create an array of configs, one for each platform. We used to pass that array to webpack compiler, but switched to passing a single one (current platform you are building) for performance reasons.
When Webpack compiler receives an array of configs, it enters multi-config mode and handles them all w/o restarting. That allows us to serve all platform bundles at the same time, just like packager.
Unfortunately, it has a couple of limitations:
- It builds all configs at once
- It recompiles all configs at once, even if one bundle didn’t change
- It’s sync - android gets build after ios
- Default devMiddleware waits for all builds to finish, even if you requested ios. That means you wait for 20 seconds even if iOS was ready after 5 seconds
- All bundles are built w/o waiting for a request (no lazy option)
All the above makes the development time significantly slower for a very specific use-case (having two simulators open at the same time). However, that use-case is important and we need to support it in a better way.
I’ll chat with Webpack team to understand how it works currently, if we are correct and how to fix that. Generally speaking, we might need to write our own dev middleware that does these things.
A solution would be to add a feature to bundle lazily as soon as you request platform bundle. That means we wouldn’t bundle android until you load Genymotion and request it. However, as I said above, currently turning on lazy option has two issues:
- It is lazy for all configs - if you request
ios,androidalso gets built - When
lazyis turned on,watchdoesn’t work (recompile on file change)
Current solution requires passing --platform flag.
This is very important to sort out now as it’s going to be an important workflow detail - whether to pass platform flags or not.
Issue Analytics
- State:
- Created 6 years ago
- Comments:14 (10 by maintainers)

Top Related StackOverflow Question
I’ll see if I can squeeze some time to look into the source code, got a ton of work ahead of me, sadly. Maybe @TheLarkInn has some immediate feedback, but I need to see the source code myself before coming up with a fix. One thing you mentioned was that it builds all configs at once. One thing I’ve seen is that you can use webpack-merge to generate a config, that could be of use for the async functionality or even switch between
iosandandroidbuilds. If webpack compiles regardless of changes, we’ve got a thread on webpack-cli on how to avoid this. Hope it helps!I’ve got some time in 2-3 weeks, got a hectic period of exams right now. If ok, can look into it then 👍