Ref #14503: Cherry-pick tests.
(cherry picked from commit 27b22f4ef5f3f291204f0e0f9f414ac503f6c8a8)
(cherry picked from commit 8dc0f2ea84e1861d8d8dfa7699268368c659f8e9)
(cherry picked from commit 936126f10de193e2bb1c8280dbc2361ca5d62e29)
Fixes #14548. Add main property to package.json
Fixes #14549. Execute the factory immediately when CommonJS is used in the browser.