ccapture.js
ccapture.js copied to clipboard
Fix for NPM usage #78
There is a proposal to solve the issue #78.
I have made the least possible changes to keep the file structure and the project the same.
The webm-writer library requires the "fs" module on Node and it causes some issues using webpack, it can be fixed on the webpack config, but i think we can delete the dependency if we target browsers.
Hi @Unsigno
I checked out your PR and set target: 'node'
in my webpack config. But I'm still getting require
related errors. Should they be analysed at build time, and the required code inlined? The required files no longer exist after the build step is performed.
ERROR in ./node_modules/ccapture.js/build/CCapture.all.min.js
Module not found: Error: Can't resolve './download' in '/Users/simonfrost/Code/threejs-tapered-hair/node_modules/ccapture.js/build'
@ ./node_modules/ccapture.js/build/CCapture.all.min.js 1:24146-24167
@ ./js/app.js
@ multi (webpack)-dev-server/client?http://localhost:8080 ./js/app.js
ERROR in ./node_modules/ccapture.js/build/CCapture.all.min.js
Module not found: Error: Can't resolve './gif' in '/Users/simonfrost/Code/threejs-tapered-hair/node_modules/ccapture.js/build'
@ ./node_modules/ccapture.js/build/CCapture.all.min.js 1:24188-24204
@ ./js/app.js
@ multi (webpack)-dev-server/client?http://localhost:8080 ./js/app.js
ERROR in ./node_modules/ccapture.js/build/CCapture.all.min.js
Module not found: Error: Can't resolve './tar' in '/Users/simonfrost/Code/threejs-tapered-hair/node_modules/ccapture.js/build'
@ ./node_modules/ccapture.js/build/CCapture.all.min.js 1:24114-24130
@ ./js/app.js
@ multi (webpack)-dev-server/client?http://localhost:8080 ./js/app.js
ERROR in ./node_modules/ccapture.js/build/CCapture.all.min.js
Module not found: Error: Can't resolve './webm-writer-0.2.0' in '/Users/simonfrost/Code/threejs-tapered-hair/node_modules/ccapture.js/build'
@ ./node_modules/ccapture.js/build/CCapture.all.min.js 1:24224-24254
@ ./js/app.js
@ multi (webpack)-dev-server/client?http://localhost:8080 ./js/app.js
Hi @SimonHFrost , thanks for your report , i was pointing directly the source so i don't noted the issue .
I updated the entry point of the NPM module , so it should works now. For browser you can link the single files ( i keep the UMD pattern ) or use the "build" source.
I tried to touch as little code as possible , but if there are still problems I could add some transpiler to build the code .
Anyway using 'node' as target will throw error , since "webm-writer" is using "fs", you can try "node-async" or find a solution for your needs. But some of the modules used are designed to work in browsers.
Best regards Unsigno.
Does this work? It would be great to get this fix published.
I tested this one and it works well!
maybe someone could merge and build? pretty please!