# Import error in app.js

**URL:** <https://discourse.threejs.org/t/import-error-in-app-js/17484>\
**Category:** Questions\
**Tags:** modules\
**Created:** [July 28, 2020, 10:21pm UTC](https://discourse.threejs.org/t/import-error-in-app-js/17484 "2020-07-28T22:21:56Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mintu-86](https://avatars.discourse-cdn.com/v4/letter/m/c6cbf5/32.png) [@mintu-86](https://discourse.threejs.org/u/mintu-86)\
**Post date:** [July 28, 2020, 10:21pm UTC](https://discourse.threejs.org/t/import-error-in-app-js/17484/1 "2020-07-28T22:21:57Z")

</div>

This is the error:  
Uncaught TypeError: Failed to resolve module specifier “three”. Relative references must start with either “/”, “./”, or “…/”.

here is the github repo:

> **[3D-web-projects/basic-shape](https://github.com/3D-web-projects/basic-shape)**
>
> Contribute to 3D-web-projects/basic-shape development by creating an account on GitHub.

using npm, node\_modules to access Three.js

---

<div class="post-metadata">

**Author:** ![Losses](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/losses/32/12357_2.png) [@Losses](https://discourse.threejs.org/u/Losses)\
**Post date:** [July 29, 2020, 4:46am UTC](https://discourse.threejs.org/t/import-error-in-app-js/17484/2 "2020-07-29T04:46:01Z")

</div>

You need Webpack or tsc

---

<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 29, 2020, 8:28am UTC](https://discourse.threejs.org/t/import-error-in-app-js/17484/3 "2020-07-29T08:28:09Z")

</div>

You are using a _bare import specifier_ which is currently not supported in browsers. It will work as soon as [Import maps](https://github.com/WICG/import-maps) are available.

If you don’t want to use a build tool like Webpack or rollup, you can also import modules over a CDN e.g.:

```auto
import * as THREE from 'https://cdn.jsdelivr.net/npm/three@0.118.3/build/three.module.js';

```

---

<div class="post-metadata">

**Author:** ![mintu-86](https://avatars.discourse-cdn.com/v4/letter/m/c6cbf5/32.png) [@mintu-86](https://discourse.threejs.org/u/mintu-86)\
**Post date:** [July 29, 2020, 2:28pm UTC](https://discourse.threejs.org/t/import-error-in-app-js/17484/4 "2020-07-29T14:28:31Z")

</div>

okay thanks, how come we can use type"module" then? what does that mean?

---

<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 29, 2020, 2:46pm UTC](https://discourse.threejs.org/t/import-error-in-app-js/17484/5 "2020-07-29T14:46:54Z")

</div>

Check out: [https://jakearchibald.com/2017/es-modules-in-browsers/](https://jakearchibald.com/2017/es-modules-in-browsers/)

---

<div class="post-metadata">

**Author:** ![mintu-86](https://avatars.discourse-cdn.com/v4/letter/m/c6cbf5/32.png) [@mintu-86](https://discourse.threejs.org/u/mintu-86)\
**Post date:** [July 29, 2020, 3:02pm UTC](https://discourse.threejs.org/t/import-error-in-app-js/17484/6 "2020-07-29T15:02:00Z")

</div>

Okay thanks. What is bare import vs say regular or es modules?

---

<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 29, 2020, 3:05pm UTC](https://discourse.threejs.org/t/import-error-in-app-js/17484/7 "2020-07-29T15:05:38Z")

</div>

This is also explained in the article. I suggest you study ES6 modules a bit since there are many existing resources about this topic.

---

<div class="post-metadata">

**Author:** ![kaktus4ever](https://avatars.discourse-cdn.com/v4/letter/k/74df32/32.png) [@kaktus4ever](https://discourse.threejs.org/u/kaktus4ever)\
**Post date:** [July 7, 2021, 7:00pm UTC](https://discourse.threejs.org/t/import-error-in-app-js/17484/8 "2021-07-07T19:00:53Z")

</div>

Hi! What if I can’t use CDN  
I’m working with webjars before migrating 127 → 128 everything worked fine.

---

<div class="post-metadata">

**Author:** ![drcmda](https://avatars.discourse-cdn.com/v4/letter/d/91b2a8/32.png) [@drcmda](https://discourse.threejs.org/u/drcmda)\
**Post date:** [July 7, 2021, 7:39pm UTC](https://discourse.threejs.org/t/import-error-in-app-js/17484/9 "2021-07-07T19:39:00Z")

</div>

same as with any other package in the javascript eco system, if you cant use cdns you need a bundler. it did somewhat work before due to a bug or workaround. that’s fixed and now browser imports work as you’d expect: they don’t, because the spec is incomplete and cannot handle dependencies. there’s a benefit for the small cost of adding a build tool, your distribution will be smaller, faster and safer (support old browsers).
