TehShrike / deepmerge

A library for deep (recursive) merging of Javascript objects
MIT License
2.75k stars 216 forks source link

TypeError: deepmerge__WEBPACK_IMPORTED_MODULE_0__ is not a function #143

Closed jillztom closed 5 years ago

jillztom commented 5 years ago

I'm trying to merge two objects and I'm getting the following error:

Uncaught (in promise) TypeError: deepmerge__WEBPACK_IMPORTED_MODULE_0__ is not a function
    at app.js?id=c1389403acbb1e1c64d3:259751
    at new Promise (<anonymous>)
    at Store.deepMergeCampaign (app.js?id=c1389403acbb1e1c64d3:259746)
    at Array.wrappedActionHandler (vendor.js?id=703b0d9ae68273220584:91458)
    at Store.dispatch (vendor.js?id=703b0d9ae68273220584:91165)
    at Store.boundDispatch [as dispatch] (vendor.js?id=703b0d9ae68273220584:91059)
    at app.js?id=c1389403acbb1e1c64d3:29520

and I used the deepmerge in my vue app as follows:

deepMergeCampaign(context, campaign){
   return new Promise((resolve, reject)=>{
      const overwriteMerge = (destinationArray, sourceArray, options) => sourceArray
      resolve(deepmerge(context.state.campaign, campaign, { arrayMerge: overwriteMerge }))
   })
}

Couldn't figure out the issue

TehShrike commented 5 years ago

Webpack has some nasty bugs. Make sure you're on deepmerge@3 to get the version that Webpack is least likely to break on.