I am trying to use a webworker in angular 2. The web worker should use the THREE JS library in the following folder:
../Angular2-App-Boilerplate/node_modules/three/src/Three.js
my angular 2 app is located here:
../Angular2-App-Boilerplate/src/app
in my component I using the THREE JS library:
import * as THREE from 'three';
and I am creating the web worker like this:
let worker = new Worker('src/app/threed-viewer/threed-model-loader.worker.ts');
let message = 'assets/data/GuyFawkesMask.ply';
worker.postMessage(message);
in the worker file
../Angular2-App-Boilerplate/src/app/threed-viewer/threed-model-loader.worker.ts
everything works fine if I keep things simple but as soon as I am importing the THREE JS library using the same line I use in my component:
import * as THREE from 'three';
I get the following error:
Uncaught SyntaxError: Unexpected token import
Any idea? Thank you,
Dino