webpack / webpack-sources

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

applySourceMap for webpack 4 is super slow #132

Closed daix6 closed 3 years ago

daix6 commented 3 years ago

https://github.com/webpack/webpack-sources/blob/d9117497dfbac940c02aa97a6fe48af633154edc/lib/applySourceMap.js#L70-L74

Webpack 4 is still using the 1.4.1 version of webpack-sources, in which version these lines are super slow, especially for those files whose lines are very long.

I came across this problem when my webpack 4 trying to load exceljs (which actually loads exceljs.min.js, an already minified file that has very long lines) and generate a sourcemap with columns.

Maybe excluding dependencies like these files is the best practice, but I assume that this should be optimized.

alexander-akait commented 3 years ago

Please update to webpack v5, we improve speed and reduce memory usage very well

daix6 commented 3 years ago

Okay......

I have tried building with webpack 5 and it does be faster. But for some reason, I have to use webpack 4 for my project :sweat:

It seems like that I can't fix old version's problem with pull request. So let it be for now...

alexander-akait commented 3 years ago

old versions of webpack-sources accept only security fixed, there are outdated, so there is only one solution - update to webpack v5, also in the latest version we very improve speed and memory usage, so please strongly consider migration, sorry, anyway feel free to feedback