I want to import two objects from different files based on some conditions, and export the imported object with different name:
if(condition1)
import {obj3, obj4} from './file1';
else
import {obj5, obj6} from './file2';
export {obj1, obj2}
I want to import two objects from different files based on some conditions, and export the imported object with different name:
if(condition1)
import {obj3, obj4} from './file1';
else
import {obj5, obj6} from './file2';
export {obj1, obj2}
You could have an intermediate importer/exporter that re-export a given import based on a condition, like this:
//exportSelector.js;
import {obj1, obj2}
let exportedObj = condition1 ? obj1 : obj2;
export exportedObj;
//import.js
import exportedObj;