Add support for building base-browser - v2
Replacing !482 (closed).
This is the same as !482 (closed), rebased on master (fixing conflict with 777416b7), and fixup commit squashed.
Closes #40522 (closed), #40501 (closed), #40500 (closed), #40499 (closed), #23656 (closed).