I am facing an issue with the config.json file and...
# suitescript
n
I am facing an issue with the config.json file and I am hoping someone can guide me regarding this. This is how it looks like:
Copy code
"paths": {
  "configdao": "./dao/config_dao",
  "constant": "./lib/constant",
  "requestlib": "./lib/request_lib",
  "responselib": "./lib/response_lib",
  "synclib": "./lib/sync_lib",
  "general": "./helpers/generalv2"
},
I cannot define a base url because this is going to be part of a bundle. It works with the files which are directly in the root directory. However, if some file/module is in another folder - let's say helpers/generalv2.js - and it tries to load requestlib, it is trying to load it from ./helpers/lib/request_lib instead of ./lib/request_lib. What am I doing wrong? I have also tried "map" but somehow it is not working.
b
i think you are describing the Parent Directory (..)
n
Let me check this.. thanks.
@battk should i write this as ../lib/then my path?
b
Probably best if you experiment with the relative paths without the config file
Move it over to the config file after you get it working
s
Use
../
to go up and
./
to stay in relative same folder
s
if you're using CWD relative paths why bother with
config.json
at all, unless you plan to change those paths (which seems unlikely for a bundle)?
n
@Sandii, the problem with ../ is that if some file/module is in another folder - let's say helpers/generalv2.js - and it tries to load requestlib, it is trying to load it from ./helpers/lib/request_lib instead of ./lib/request_lib. Similarly, if I add ../ then the modules which are under lib folder, they will try to load it from the root folder instead.
@stalbert you have a fair point. Based on the issues I am facing, I am deciding to drop the config.json