I am new to nodejs REST api creation. I am using ES6 format. I have decided to create an environment based configurations and stored in different files.
So the issue I came across was
const myUrl = path.resolve(`lib/${process.env.NODE_ENV}.js`);
import { myVar } from myUrl;
I try importing files like shown above, but it doesnt work. I understand it can be easily solved by using
const myVar = require(myUrl)
But I want to know if there is any way to continue using import itself instead of require?
MDN has all ways of importing, but i could not find a way on how to import from a constructed url like above