This happened to me because I was importing my code in the head tag, so it was potentially running and attempting to bootstrap before the DOM was ready.
You can either move the script to the bottom of the body tag, or put the bootstrap code within an event listener:
document.addEventListener("DOMContentLoaded", function(event) {
bootstrap(AppComponent);
});
or:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example app</title>
</head>
<body>
<my-app></my-app>
</body>
<script src="https://stackoverflow.com/questions/35644123/main.js" charset="utf-8"></script>
</html>