I have index.html file where I have html head body tags and I have constant.js file from which I want to use a constant. how to define that constant in constant.js and how to use it in index.html and where to place the import statement.
When I include with this in the head section of HTML
<script type="module" src="../home/constants.js"></script>
constants.js file contains only this
const surl = "http://localhost:8000/"
I got this error in browser
Loading module from “http://localhost:8000/constants.js” was blocked because of a disallowed MIME type (“text/html”)
Also I am not able to use the the sdata_url
Uncaught ReferenceError: sdata_url is not defined
here is my html file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title >CandleCharts</title>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="https://code.highcharts.com/css/stocktools/gui.css">
<link rel="stylesheet" type="text/css" href="https://code.highcharts.com/css/annotations/popup.css">
<script src="https://code.jquery.com/jquery-3.5.1.min.js"
integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"
integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI"
crossorigin="anonymous"></script>
<!-- my modules -->
<script type="module" src="../home/constants.js"></script>
</head>
<body>
<div id="top_bar">
</div>
<div id="container" style="height: 700px; min-width: 310px" class="chart"></div>
<script type="text/javascript">
console.log(sdata_url)
</script>
</body>
</html>