tensorspace-team/tensorspace

Build tensorspace as CommonJS module

BoTime opened this issue · 3 comments

Goal:

Use tensorspace in Node.js with require() syntax

  1. Refactor source code (add import * as THREE from 'three')

  2. Two input files:

  • tensorspace.js -> tensorspace.cjs.js
  • tensorspace.dev.js -> tensorspace.dev.cjs.js

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

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 😎