I just came across this line of code:
const config = require(__dirname + '/../config/config.json')[env];
It imports one specific field from a json file, depending on an environment variable (in this case it imports different keys for testing, development and production).
What would the equivalent be in a javascript ES6 module? I am currently using this method:
import config from "../config/config.json" assert { type: "json" };
const settings = config[NODE_ENV];
Which requires importing all the settings and declaring another variable. Is there any way to import just one field?