Within our angular application built with typescript, we make use of lodash. Our current approach to importing lodash is demonstrated below:
import * as _ from 'lodash';
//.. code which utilizes _.pluck()
However, in order to optimize for tree shaking, we are looking to switch to the following method:
import {pluck, delay} from 'lodash';
//.. code which uses _.pluck() will need adjustment to pluck()
The challenge we face is that transitioning to the second import option requires numerous manual changes to the code, as it eliminates the namespace of _
and may lead to naming conflicts. Is there a way to specify the specific imports while retaining the namespace? My initial attempt was as shown below, but it proved unsuccessful:
import {pluck, delay} as _ from 'lodash';
//.. code which uses _.pluck() needs changed to pluck()