I have just installed babel loader, to use babel with webpack.
It brings in 3 additional node dependencies, however only 2 of these I expected
from the babel loader package.json
"peerDependencies": {
"babel-core": "*",
"webpack": "*"
},
So why am I also getting node-libs-browser I don't know what it is, and don't want the extra module in my devDependencies
node-libs-browser is a peer dependency of Webpack. As stated in the package page it provides certain Node libraries for browser usage. Obviously modules such as fs won't be available there but you can still use quite a few.
babel-loader exposes a loader-builder utility that allows users to add custom handling of Babel's configuration for each file that it processes.
Babel is a compiler; it takes an ESNext program and produces an equivalent ES3+ compatible program. babel-loader does what ts-loader does for TypeScript; passes off files to the Babel compiler, and returns the result to be used in the bundle in-place of the original source program.
IMPORTANT! As pointed out by Patrik, Webpack can deal with it now so you don't need to install it separately. It has been moved as a direct dependency of Webpack.
OLD ANSWER
node-libs-browser is a peer dependency of Webpack. As stated in the package page it provides certain Node libraries for browser usage. Obviously modules such as fs
won't be available there but you can still use quite a few.
It is recommended that you maintain the versions of peer dependencies like this yourself. In fact that's going to be the default starting from npm 3. For now they get installed automatically. Therefore it's a good idea to have them listed explicitly at devDependencies
even if that might feel like some extra work at the moment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With