Let's start with an example:
import renewCreepLife from '../tasks/renew_creep_life';
import harvestEnergy from '../tasks/harvest_energy';
import pickupEnergy from '../tasks/pickup_energy';
import storeEnergy from '../tasks/store_energy';
import upgradeController from '../tasks/upgrade_controller';
const taskFuncs = {
[Tasks.RENEW]: renewCreepLife,
[Tasks.PICKUP_ENERGY]: pickupEnergy,
[Tasks.HARVESTING]: harvestEnergy,
[Tasks.STORING]: storeEnergy,
[Tasks.UPGRADING]: upgradeController,
};
Is there any way to simplify this so that I'm not creating these pointless temporary variable names? Something like:
// incorrect but desired syntax
const taskFuncs = {
[Tasks.RENEW]: import '../tasks/renew_creep_life',
};
N.B. each of those files is using export default function()