Thanks, this and subhaze's comment pointed me in the right direction. DeliveryMethods isn't the only constant I'd want to use, so export default
doesn't work if I want to have all my constants in a single file for ease of maintenance. What I've done is this:
export const DeliveryMethods = {
DELIVERY: "Delivery",
CARRIER: "Carrier",
COLLATION: "Collation",
CASH_AND_CARRY: "Cash and carry"
};
In my components I have import {DeliveryMethods} from 'src/config.js'
, which allows me to simply use e.g. DeliveryMethods.COLLATION
. I can export/import any number of constants clearly and simply. Still feeling my way round Javascript modules!
LATER: Following WaldemarIce's suggestion, I have changed this to:
export const DeliveryMethods = Object.freeze({
DELIVERY: "Delivery",
CARRIER: "Carrier",
COLLATION: "Collation",
CASH_AND_CARRY: "Cash and carry"
});
That works better.