I want to run a JavaScript module with external dependencies in the browser. Is that possible? I know that Babel can be executed in the browser, so that should be possible.
Let's say that I have a following module:
const module = `
import React from "react";
import ReactDOM from "react-dom";
ReactDOM.render(<div>Hello, world!</div>, document.body);
`
Now, how to „compile” it so that it can be executed in the browser? Also, the tricky part is that I want to preserve versions, so let's say that I want to use version 16 of React and ReactDOM.