overhaul dev/prod script loading
This commit is contained in:
parent
de2a105243
commit
4e44790ca2
@ -1,7 +1,6 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html >
|
||||
<head>
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data:; connect-src 'self'; style-src 'self'; script-src 'self';report-uri /csp-reports">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<meta name="theme-color" content="#000">
|
||||
@ -28,6 +27,14 @@
|
||||
<script src="js/lib/moment.min.js"></script>
|
||||
|
||||
<!-- bootstrap script -->
|
||||
<script src="js/bootstrap.js"></script>
|
||||
<script>
|
||||
function dev_fallback(){
|
||||
var s = document.createElement("script");
|
||||
s.setAttribute("src", "js/main.js");
|
||||
s.setAttribute("type", "module");
|
||||
document.body.appendChild(s);
|
||||
};
|
||||
</script>
|
||||
<script src="js/bundle.js" onerror="dev_fallback()"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
16
public/js/bootstrap.js
vendored
16
public/js/bootstrap.js
vendored
@ -1,16 +0,0 @@
|
||||
(function(){
|
||||
var s = document.createElement("script");
|
||||
|
||||
if (location.host === "127.0.0.1:8080") {
|
||||
//dev
|
||||
s.setAttribute("src", "js/main.js");
|
||||
s.setAttribute("type", "module");
|
||||
|
||||
} else {
|
||||
//prod
|
||||
s.setAttribute("src", "js/bundle.js");
|
||||
|
||||
}
|
||||
|
||||
document.body.appendChild(s);
|
||||
})();
|
Loading…
Reference in New Issue
Block a user