0

I'm trying to setup up a simple Plnkr project with Angular and ThreeJS. I've got this so far - https://next.plnkr.co/edit/Jm4D2zgLtiKBGghC?preview

But as soon as I uncomment //var scene = new THREE.Scene(); on app.ts There is an error in the console. It's quite hard to understand the error, but I'm presuming it's simply I haven't imported the ThreeJS library correctly.

I've added in <script src=" https://unpkg.com/[email protected]/build/three.js"></script> to the index.html, I'm not sure what else to do.

On my local environment all I had to do was to use npm three install then I was able to import the lib correctly import * as THREE from 'three';

2
  • Just follow the steps described in this thread: stackoverflow.com/questions/44293797/… Commented Jun 10, 2018 at 17:14
  • If you comment out import * as THREE from 'three';, it seems to work Commented Jun 10, 2018 at 17:30

1 Answer 1

1

You should tell systemjs where to find three package:

config.js

map: {
  ...
  'three': 'npm:three'
},

Forked Plunker

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.