How to setup plnkr with Angular and ThreeJS

44 views Asked by At

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';

1

There are 1 answers

0
yurzui On BEST ANSWER

You should tell systemjs where to find three package:

config.js

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

Forked Plunker