Use solc in a web browser via Web Workers
masterCompilation is a resource-intensive task that can block the browser's main thread. Because some browsers disallow synchronous compilation on the main thread for modules larger than 4KB, the only supported way to use solc in a web browser is through a Web Worker.
To implement this, you must load the soljson binary and the solc/wrapper within the worker script, then communicate with the main thread using postMessage and addEventListener('message', ...).
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body
<script>
var worker = new Worker('./dist/bundle.js');
worker.addEventListener('message', function (e) {
console.log(e.data.version)
}, false);
worker.postMessage({})
</script>
</body>
</html>