xxxxxxxxxx
//make sure whether include type="module" in script tag
<script type="module" src="module.js"></script>
xxxxxxxxxx
//Add type=module to your index.js script tag (not just the package script tag)
<script type="module" src="./index.js"></script>
xxxxxxxxxx
[Solved] “Uncaught SyntaxError: Cannot use import statement outside a module” when importing ECMAScript 6