Cannot use import statement outside a module

 今天在練習vue的時候,在瀏覽器中遇到了下列的錯誤:
Uncaught SyntaxError: Cannot use import statement outside a module 

這個原因是在HTM網頁中,透過script標籤加載Javascript腳本,但是瀏覽器默許的腳本語言是Javascript,因此我一般都是省略了type="application/javascript",而module的加載方式是ES6的實現,所以需要在script標籤中加入type="module"

例如:
<script type="module">
    import ButtonCounter from './element.js'
</script>

Windows 11安裝時跳過網路連線