I have an app built with Node-Gulp-Webpack.
I have an external JavaScript file external.js that is not local to my app, but I want to be able to require it in my app. This file is on a path for which there is an environment variable named MY_PATH.
How can I include this external.js as-is in my build without making a Node module out of it?
So far, this does not work and doesn't return a useful error message:
var external = require(process.env.MY_PATH + '/external.js');
require'ing this external file into a client side file, or in your nodejs app?process.env.MY_PATHbeing resolved correctly? What is the output ofconsole.log(process.env.MY_PATH)?require(process.env.MY_PATH)and it worked using the node REPL, it didn't work at first because I had to open a new cmd prompt.