Add tests and basic support for batch exports.

cc @caridy @dominic

This is enough to make batch exports work for the bundle format, but not for CommonJS. Are there any tests that I should add that aren't covered by the pretty simple case I have here?