I was reading this book. In one of the codes in chapter 5 of the book, I saw the code below:
<!-- index.html file -->
<html>
<head>
<meta charset="utf-8" />
<script src="https://unpkg.com/vue@next"></script>
</head>
<body>
<div id="app"></div>
</body>
<script type="module">
import GlobalApp from "./global-app.js";
var app = Vue.createApp({
components : {
GlobalApp:GlobalApp
},
template : "<GlobalApp />"
});
var vm = app.mount("div#app");
</script>
</html>
That code is for a main html
file that runs a vue app (not in SFC format). If you notice the code, it put script type="module"
tag after </body>
tag. I know that there are some similar questions like this one in this problem. But I could not found anything about script type="module"
in none of them. I want to know that is this usage wrong or non-valid that we put script type="module"
after </body>
?