What is node-libs-browser and why is it installed when babel-loader is installed

I just installed the babel bootloader to use babel with webpack.

It contains 3 additional node dependencies, however, only 2 of them I expected

from the bootel loader package.json

"peerDependencies": { "babel-core": "*", "webpack": "*" }, 

So why am I also getting node-libs-browser . I do not know what it is, and I do not want an additional module in my devDependencies

+6
source share
1 answer

IMPORTANT! As Patrick noted, Webpack can handle this now, so you don't need to install it separately. It is moved as a direct dependency on Webpack.


OLD ANSWER

node-libs-browser is a peer-to-peer dependency of Webpack. As indicated on the package page, it provides specific Node libraries for use by the browser. Obviously modules like fs are not available, but you can still use quite a lot.

It is recommended that peer dependency versions be maintained, as is their own. In fact, this will be the default starting with npm 3. They are currently installed automatically. Therefore, it would be nice if they explicitly pointed to devDependencies , even if this might seem like some additional work at the moment.

+12
source

Source: https://habr.com/ru/post/989708/


All Articles