Last active
August 23, 2020 17:33
-
-
Save Uzwername/ee989c2a914da022b8ed8006206096da to your computer and use it in GitHub Desktop.
HtmlWebpackPlugin - First attempt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en" dir="ltr"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Handling script loading errors with HtmlWebpackPlugin</title> | |
</head> | |
<body> | |
<h1 id="content"></h1> | |
<script> | |
(function(){ | |
function showErrorPage() { | |
// Doesn't matter for now | |
} | |
var appScript = document.querySelector('script[src^="bundle"]'); | |
appScript.addEventListener('error', showErrorPage); | |
})(); | |
</script> | |
<!-- | |
HTMLWebpackPlugin will insert bundled script here on build. | |
It will look something like this: | |
<script src="bundle.foo12.js"></script> | |
--> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment