TehShrike / deepmerge

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

Webpack Can't resolve 'deepmerge' in node_modules #183

Open NA-Dev opened 4 years ago

NA-Dev commented 4 years ago

I am on the latest version of deepmerge. I have read old issues on this and tried all the different import and require syntaxes suggested. No luck. Guess I will go back to the old version that was working.

TehShrike commented 4 years ago

mmk

Can you provide any helpful information?

What version are you using? (npm ls deepmerge)

What version of Webpack?

What is the last version of deepmerge that Webpack is able to resolve in your app?

Can you reproduce the issue in a small example repository?

sveyret commented 4 years ago

I also faced this problem again. From what I see, the problem most probably comes from Webpack. I am using version 4.2.2 of deepmerge, and this did not change. But I updated the version of Webpack from 4.41.6 to 4.43.0.

sveyret commented 4 years ago

After some short investigations, I found this which may be the cause of this “new” problem.

phil-w commented 4 years ago

Same problem with webpack 5, can't work out what it is yet, lots of google entries, none of them work. I don't really care about the politics, I just need to get past this error.

Is there an alternative package to deepmerge I can use - it doesn't matter to me, I just need the functionality, not the TS/JS details.

I "fixed" it by simply putting the source module into my repo and importing it that way, which works fine. One weird thing is that I have another Webpack 5 beta with precisely the same version of "deepmerge" in it, and that imports fine. Ah well, time to move on.

sveyret commented 4 years ago

In my project, I ended modifying my import to:

import type * as DeepMergeType from 'deepmerge'
const deepMerge: typeof DeepMergeType = require('deepmerge')