I'm trying to add gm module to my cloud. Since parse is not a node.js environment I made small changes over other modules I used, but gm module requires so much node core module. Do I have to push all of the sub modules to parse. Also how can I add the core modules. Changing require('xxx')
to require('xxx/index.js')
or require('xxx/xxx.js')
failed.
These are the modules I could find where gm is depended and changed these files. I did include all the files in the modules only changed the following ones.
- gm/index.js
- events/events.js
- util/util.js
- stream/index.js
- emitter/index.js (also depends on util)
- asynclist/index.js
- eventproxy/index.js
changing all of these gives error
Result: Error: Module ./lib/eventproxy not found
at libs/eventproxy/index.js:1:18
at libs/asynclist/index.js:1:18
at libs/emitter/index.js:1:17
at libs/stream/index.js:22:15
at libs/gm/index.js:6:14
at main.js:118:14
// This error is caused by ./lib/eventproxy.
// It must be cloud/libs/asynclist/node_modules/eventproxy/lib/eventproxy.js
// Parse doesn't recognize './' as this folder in cloud code
where gm/index.js's require part is
var Stream = require('cloud/libs/stream/index.js').Stream;
var EventEmitter = require('cloud/libs/events/events.js').EventEmitter;
var util = require('cloud/libs/util/util.js');
My cloud folder structure is
cloud/libs/gm
cloud/libs/events
cloud/libs/util
cloud/libs/stream
cloud/libs/emitter
cloud/libs/asynclist
cloud/libs/eventproxy
EDIT: I found more dependencies. According to this, gm has 36 dependent libraries and I clearly need a simple solution.
EDIT: for the relative path problem with parse, this is a solution but as I said I need a simple way for the whole problem.