Hi there! I’m looking to include a dependent js file to a serverless but when I do something like `const urls = require(‘./urls’)` it works locally when I run hs project dev. But after uploading it says it can’t find the file.
Is there something specific to do here to get it working?
Hi, @FOman Thanks for posting this question. I’d like to invite some of our community experts to the conversation — hey @Teun@JBrake@ChrisoKlepke@Kevin-C, do you have any tips you can share to help get @FOman moving forward?
Oh yes, I’ve come across this before. I think you you need to create your code as a package and use require like you do for axios or request. Then build/bundle the file to upload to HS.
I’ve not done this for my own code (yet, but have reasosn to in the future), but have for unsupported packages in HS like stripe and encryption. I think the approach would the same.
Im not a node developer per se so wont go into the technical aspects of doing it. (a.k.a. I needed help setting this up and get running by someone more knowledgeable of such things.) Do you know any node developers that might help?
Jonathan
Cool, yeah I was thinking along the same lines. I tried out including the file in the package.json. It didn’t work the way i wanted but maybe it is along those lines. I’ll update if I have anything, or hopefully someone konws the solution!