在html的script标签中使用es6中的import关键字导入模块的时候会报如下地错“Uncaught SyntaxError: Cannot use import statement outside a module“。
<script type="text/javascript">
import test from './module.js';
</script>
究其原因,es6的module语法需要放在type为module下就好了
<script type="module">
import test from './module.js';
</script>