Thursday, December 12, 2019

Lodash - 4 and webpack 4, _.get returns undefined when path contains array

Lodash - 4 and webpack 4, _.get returns undefined when path contains array 


Solution:

in webpack.config.js:

plugins: [
  new LodashModuleReplacementPlugin({
    collections: true,
    shorthands: true,
    currying: true,
    flattening: true,
    paths: true,
    caching: true  }),

need to add paths: true, and caching: true. 

This should remove undefined and return actual value,

if not then please let me know in comments.   

Ad