# Why does \<script type="module"\> not work?

**URL:** <https://discourse.threejs.org/t/why-does-script-type-module-not-work/17540>\
**Category:** Questions\
**Tags:** modules\
**Created:** [July 30, 2020, 1:05pm UTC](https://discourse.threejs.org/t/why-does-script-type-module-not-work/17540 "2020-07-30T13:05:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![haho](https://avatars.discourse-cdn.com/v4/letter/h/958977/32.png) [@haho](https://discourse.threejs.org/u/haho)\
**Post date:** [July 30, 2020, 1:05pm UTC](https://discourse.threejs.org/t/why-does-script-type-module-not-work/17540/1 "2020-07-30T13:05:29Z")

</div>

Hi, am a complete three.js beginner -  
and maybe this is a fundatmental missunderstanding,  
but:  
can you help me what’s wrong with this code (placed in a wordpress page),  
the javascirpt code in the type="module part will not be executed:

thank you ! (sorry for the fomatting on my old pc -  
i had to insert a blank before each “script”- tag and to XXX-out the links)

```auto
<php get_header(); ?>
<?php get_footer(); ?>

< script src=http://haho.dreampress.at/wp-content/themes/twentyfourteen/js/three.min.js>< /script>

< script type="module">
	
$j("#main").append('< canvas id="canvas" width="500" height="500" style="background:pink;">< /canvas>');

import * as THREE from 'XXXhttp://haho.dreampress.at/wp-content/themes/twentyfourteen/js/module.js' ;

import {OrbitControls } from 'XXXhttp://haho.dreampress.at/wp-content/themes/twentyfourteen/js/OrbitControls.js';

import { OBJLoader2 } from "XXXhttp://haho.dreampress.at/wp-content/themes/twentyfourteen/js/OBJLoader2.js";

import { MTLLoader } from "XXXhttp://haho.dreampress.at/wp-content/themes/twentyfourteen/js/MTLLoader.js";

import { MtlObjBridge } from "XXXhttp://haho.dreampress.at/wp-content/themes/twentyfourteen/js//MtlObjBridge.js";

function main() 
......
main();

```

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [July 30, 2020, 2:12pm UTC](https://discourse.threejs.org/t/why-does-script-type-module-not-work/17540/2 "2020-07-30T14:12:18Z")

</div>

Are you able to share a live link to your application?

Does it work if you load the JS files like so:

```auto
import * as THREE from 'https://cdn.jsdelivr.net/npm/three@0.119/build/three.module.js' ;
import { OrbitControls } from 'https://cdn.jsdelivr.net/npm/three@0.119/examples/jsm/controls/OrbitControls.js';
import { OBJLoader2 } from "https://cdn.jsdelivr.net/npm/three@0.119/examples/jsm/loaders/OBJLoader2.js";
import { MTLLoader } from "https://cdn.jsdelivr.net/npm/three@0.119/examples/jsm/loaders/MTLLoader.js";
import { MtlObjBridge } from "https://cdn.jsdelivr.net/npm/three@0.119/examples/jsm/loaders/obj2/bridge/MtlObjBridge.js";

```

---

<div class="post-metadata">

**Author:** ![haho](https://avatars.discourse-cdn.com/v4/letter/h/958977/32.png) [@haho](https://discourse.threejs.org/u/haho)\
**Post date:** [July 30, 2020, 2:15pm UTC](https://discourse.threejs.org/t/why-does-script-type-module-not-work/17540/3 "2020-07-30T14:15:21Z")

</div>

yes:

[http://haho.dreampress.at/webgl001/](http://haho.dreampress.at/webgl001/)

thank you - i’ll\_try your suggestion

---

<div class="post-metadata">

**Author:** ![haho](https://avatars.discourse-cdn.com/v4/letter/h/958977/32.png) [@haho](https://discourse.threejs.org/u/haho)\
**Post date:** [July 30, 2020, 2:54pm UTC](https://discourse.threejs.org/t/why-does-script-type-module-not-work/17540/4 "2020-07-30T14:54:32Z")

</div>

Phantastic - it works now on my smartphone google browser !

thank’s al lot !

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [July 30, 2020, 3:09pm UTC](https://discourse.threejs.org/t/why-does-script-type-module-not-work/17540/5 "2020-07-30T15:09:06Z")

</div>

Yep, looks good!
