Build tensorspace as CommonJS module
BoTime opened this issue · 3 comments
BoTime commented
Goal:
Use tensorspace in Node.js with require()
syntax
BoTime commented
-
Refactor source code (add
import * as THREE from 'three'
) -
Two input files:
- tensorspace.js -> tensorspace.cjs.js
- tensorspace.dev.js -> tensorspace.dev.cjs.js
syt123450 commented
For threejs, added:
import * as THREE from "three";
For tfjs, added:
import * as tf from "@tensorflow/tfjs";
For tween.js, added:
import * as TWEEN from "@tweenjs/tween.js";
For Stats.js, added:
import Stats from "stats.js/src/Stats";
For trackballcontrol, added:
import TrackballControls from "three-trackballcontrols";
txmxthy commented
For threejs, added:
import * as THREE from "three";For tfjs, added:
import * as tf from "@tensorflow/tfjs";For tween.js, added:
import * as TWEEN from "@tweenjs/tween.js";For Stats.js, added:
import Stats from "stats.js/src/Stats";For trackballcontrol, added:
import TrackballControls from "three-trackballcontrols";
Hi, I'm trying to use tensorspace to visualize one of my projects within a page on my website which is using next js and I'm having some trouble with importing the dependencies.
Is there a way to do the imports like this in js rather than with the script tags? I've tried variations of both without much luck - might end up just embedding a codepen 😎