clmtrackr icon indicating copy to clipboard operation
clmtrackr copied to clipboard

Bug with library included and builded project

Open antoninlanglade opened this issue 6 years ago • 4 comments

Hello,

I've an issue when i'm trying to build my project (with webpack 3.0) with your library included (working on localhost) :

  • Package JSON : "clmtrackr": "^1.1.2"

  • Component :

import clm from 'clmtrackr';
this.ctrack = new clm.tracker();
this.ctrack.init();

capture d ecran 2017-11-05 a 22 26 36

capture d ecran 2017-11-05 a 22 26 30

Thanks

antoninlanglade avatar Nov 05 '17 21:11 antoninlanglade

@antoninlanglade did you ever find a solution for this issue? I am having the same issue using react and cannot figure it out.

Antham22 avatar Nov 28 '17 17:11 Antham22

@Antham22 Try doing your Initialization within a lifecycle function.

import clm from 'clmtrackr';

export default class Home extends React.PureComponent {
    componentWillMount() {
       this.ctrack = new clm.tracker();
       this.ctrack.init();
    }
    ...
}

Technopathic avatar Dec 25 '17 10:12 Technopathic

Also seeing this, it's not a matter of incorrect initialisation or React but it appears that it is due to the built ES module containing a mixture of ES and CJS modules which is likely throwing off your webpack build (hence why it's erroring out regarding module not being defined). Been wrestling with trying to get it to function as a node module for a few days now, but at this point I've just resigned to including clm as a script in the page because I can't spend much more time trying to figure out exactly why the node module seems to completely break webpack.

bengsfort avatar Mar 19 '18 08:03 bengsfort

@bengsfort Check out this repo: https://github.com/Technopathic/CLM-Quickstart

It uses webpack 3.10.0 with clmtrackr as a node module. I attempted to recreate the basic webcam face tracking example in the app/containers/Home/index.js file.

Technopathic avatar Mar 19 '18 20:03 Technopathic