liady / webpack-node-externals

Easily exclude node modules in Webpack
MIT License
1.3k stars 62 forks source link

Mention WebPack 5 externalsPresets option in readme #88

Closed david-fong closed 3 years ago

david-fong commented 3 years ago

(This is just a suggestion).

WebPack v5 has added a new option called externalsPresets. The "node" setting is probably what most people will want to use for code that will only run on the NodeJS runtime. For people who are new to WebPack and who find this package, it may be helpful to them to mention that they don't need this plugin for such a use-case.

liady commented 3 years ago

@david-fong thanks for this suggestion. Actually the externalsPresets: { node: true } setting will only externalize the built in packages of node, and not the installed mode modules themselves. If you'll look at the official Webpack documentation you can actually see that this plug-in is still the recommended way for externalizing node modules. The externalsPresets key only replaces the target key in the config in that sense, and not the entire externals mechanism. Thanks again for the suggestion.