3

I can happily upload npm module source, but if I try to require('foo') then it ignores the node_modules directory, unless I exactly specify require('./node_modules/foo/index.js').

How can I work around this to use npm modules on parse?

Paul Tarjan
  • 48,968
  • 59
  • 172
  • 213

2 Answers2

1

Parse does not support npm now. You have to locate it manually. There are still problem about it. Suppose I added 'cheerio' like this require('cloud/cheerio'), so parse will get the cheerio module. But cheerio has some dependencies. So inside the cheerio source code you will see there are lots of require('.........'), if you want to use cheerio you have edit them require('cloud/cheerio/lib/path/etc.........'), which is a very bad solution. Even parse cloud do not lets you upload json file. Cheerio use few json files for him.

So for now you can't add npm with parse. It's a MAJOR fault of parse in this world of javascript.

Imdadul Huq Naim
  • 364
  • 5
  • 10
1

Until Parse supports npm, I'm using http://browserify.org/ to bundle all my code into a single cloud.js file and then uploading that.

Paul Tarjan
  • 48,968
  • 59
  • 172
  • 213