webpack / webpack-sources

Source code handling classes for webpack
MIT License
262 stars 71 forks source link

TypeError: Cannot read property 'length' of null #122

Closed Superoryco closed 3 years ago

Superoryco commented 3 years ago

Somehow the 'checkOriginalContent' function in ReplaceSource.js failed due to null value from sourceContents[sourceIndex], need a fix maybe.

Superoryco commented 3 years ago

121

modestfake commented 3 years ago

First I got the the error in ReplaceSource.js. I applied the same fix as in the PR #121, it helped but then I also get similar error but in a different place image

Seems like it's the same stack trace as in https://github.com/webpack/webpack/issues/13879

Superoryco commented 3 years ago

@modestfake I've not seen this problem yet in my project, try this maybe?

modestfake commented 3 years ago

@Superoryco yes, it worked! Thanks for the fix! Hopefully it will be released soon.

Superoryco commented 3 years ago

@sokra Report: Exception still exists in 3.0.4, but from a different place: at checkOriginalContent (.../node_modules/webpack-sources/lib/ReplaceSource.js:169:40)

Superoryco commented 3 years ago

Fixed by d103b21, if still happened, delete node_modules folder and .lock file, then a fresh install.