index.js:2 Uncaught SyntaxError: Cannot use import statement outside a module code example

Example 1: Uncaught SyntaxError: Cannot use import statement outside a module

1. Inside scripts file import the following module
	import {a} from "./module.js";
	alert(a);
    
2. add that script inside file you want to use it
	<script type="module" src="PATH_TO_FILE"></script>

Example 2: Uncaught SyntaxError: Cannot use import statement outside a module three.js

//If you already put this and still error.
<script src="/node_modules/three/examples/jsm/controls/OrbitControls.js"></script>
//Try changing jsm to js
<script src="/node_modules/three/examples/js/controls/OrbitControls.js"></script>