ccapture.js icon indicating copy to clipboard operation
ccapture.js copied to clipboard

Issues with NPM usage

Open aceslowman opened this issue 7 years ago • 1 comments

I have been having some issues getting CCapture to work with NPM.

First, when requiring ccapture.all.min.js on an empty project, it results in these errors:

ERROR in ./node_modules/ccapture.js/build/CCapture.all.min.js
Module not found: Error: Can't resolve './ArrayBufferDataStream' in '/Users/austin/code/THREEJS/threejs_node/node_modules/ccapture.js/build'
 @ ./node_modules/ccapture.js/build/CCapture.all.min.js 1:10753-10787
 @ ./public/js/main.js

ERROR in ./node_modules/ccapture.js/build/CCapture.all.min.js
Module not found: Error: Can't resolve './BlobBuffer' in '/Users/austin/code/THREEJS/threejs_node/node_modules/ccapture.js/build'
 @ ./node_modules/ccapture.js/build/CCapture.all.min.js 1:10788-10811
 @ ./public/js/main.js

ERROR in ./node_modules/ccapture.js/build/CCapture.all.min.js
Module not found: Error: Can't resolve 'fs' in '/Users/austin/code/THREEJS/threejs_node/node_modules/ccapture.js/build'
 @ ./node_modules/ccapture.js/build/CCapture.all.min.js 1:5873-5886
 @ ./public/js/main.js

With this, and after digging through issues, specifically this one (https://github.com/spite/ccapture.js/issues/36), I attempted to just use a script tag to import it without NPM, which still results in an error stating TypeError: t is null, using the following configuration.

import * as THREE from "three";
import SceneManager from "./SceneManager";

const canvas = document.getElementById('canvas');
const sceneManager = new SceneManager(canvas);

const capturer = new CCapture( { format: 'png' } );

const render = () => {
  requestAnimationFrame(render);

  sceneManager.update();

  capturer.capture( canvas );
}

render();
capturer.start();

Is there a part of the configuration that I'm missing?

aceslowman avatar Mar 27 '18 16:03 aceslowman

Redirected to https://github.com/spite/ccapture.js/issues/78

spite avatar Mar 27 '18 17:03 spite