Skip to content

Commit

Permalink
docs: fix externalsPreset docs
Browse files Browse the repository at this point in the history
Add `target: 'node'` even when using `externalsPreset`
  • Loading branch information
liady committed Apr 29, 2021
1 parent 1aa8f1c commit fc08261
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -29,14 +29,15 @@ module.exports = {
```
And that's it. All node modules will no longer be bundled but will be left as `require('module')`.

**Note**: For Webpack 5, replace `target: 'node'` with the `externalsPreset` object:
**Note**: For Webpack 5, in addition to `target: 'node'` also include the `externalsPreset` object:
```js
// Webpack 5

const nodeExternals = require('webpack-node-externals');
...
module.exports = {
...
target: 'node',
externalsPresets: { node: true }, // in order to ignore built-in modules like path, fs, etc.
externals: [nodeExternals()], // in order to ignore all modules in node_modules folder
...
Expand Down

0 comments on commit fc08261

Please sign in to comment.