Question: Im starting with three.js. After trying to implement orbit controls i have some errors. It looks simple but i cannot find a good solution for my errors. When im trying to implement controls like : 

`var controls = new THREE.OrbitControls(camera, renderer.domElement);`

im getting these errors

[Cannot use import statement outside a module and THREE.OrbitControls is not a constructor](https://i.stack.imgur.com/pVPs7.png)

I added both threejs and orbitcontrols just before starting a new script. What am I doing wrong here?

```

        <script src="scripts/three.js"></script>   
        <script src="scripts/OrbitControls.js"></script>

        <script type="text/javascript">
                var scene = new THREE.Scene();

                var camera = new
                THREE.PerspectiveCamera(75,window.innerWidth/window.innerHeight, 0.1, 1000);

                var renderer = new THREE.WebGLRenderer();
                renderer.setSize(window.innerWidth, window.innerHeight);
                renderer.setClearColor(0x888888,1)
                document.body.appendChild(renderer.domElement);

                var controls = new THREE.OrbitControls(camera, renderer.domElement);

```

Answer: 
**Online Resource, Threejs Host, Sample Code**

---

```
           <script type="module">
            import * as THREE from 'https://three.ipozal.com/threejs/resources/threejs/r110/build/three.module.js';
            import { OrbitControls } from 'https://three.ipozal.com/threejs/resources/threejs/r110/examples/jsm/controls/OrbitControls.js';
            import { OBJLoader2 } from 'https://three.ipozal.com/threejs/resources/threejs/r110/examples/jsm/loaders/OBJLoader2.js';

            function main() {
.....
</script>

```
What worked for me was including type="module" as @kaveh-eyni mentioned but then npm installing the "deprecated" modules directly into my project.

* `npm install --save three-orbitcontrols`
* `npm i --save three-gltf-loader`

and then

```
<script type="module">
import * as THREE from 'three/build/three.module'
import OrbitControls from 'three-orbitcontrols'
import GLTFLoader from 'three-gltf-loader

```