Reputation: 689
I have a directory structure,
--- root
|--- server
|--- lib
|--- core
|--- Test.js
|--- Test2.js
|---config
|--- Common.js
in my test.js I require common.js files so I use this
var test = require("...../config/common.js"), it shows "can't find the module Cannot find module ' ...../config/common.js"
Any suggestions?
Upvotes: 0
Views: 580
Reputation: 172
with normal rquire using express
var test = require("../../../config/common.js")
or with es6 you can do it like this way
import test from ("../../../config/common.js")
Upvotes: 1