After hours of searching and testing. Finally, I give up. I am using Angular2 with webpack, I am trying to use three.js in my Angular2 application. I installed the npm @ type / three package
sudo npm install @types/three --save
And I edited my tsconfig.json in several ways. I even tried adding three / three imports to my polyfills.browser.ts file. But I keep getting module errors. Maybe something is wrong with my tsconfig.json, as shown below.
{ "compilerOptions": { "module": "commonjs", "target": "es5", "outDir": "dist", "rootDir": ".", "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "moduleResolution": "node", "typeRoots": [ "./node_modules/@types" ], "types": [ "core-js", "node", "three" ] }, "exclude": [ "node_modules" ], "awesomeTypescriptLoaderOptions": { "useWebpackText": true }, "compileOnSave": false, "buildOnSave": false, "atom": { "rewriteTsconfig": false } }
and I tried at least the following syntax in my Component
import {THREE} from "@types/three"; import {THREE} from "three"; import "@types/three"; import "three"; import * as _ from "@types/three"; import * as _ from "three";
Actually, I donβt quite understand how all these tsconfig, webpackconfig work, so when I try to implement this type / module, I have no idea what I'm doing. Any help would be appreciated, thanks!
angular typescript
mok
source share