Regarding this part of the docs:
|
**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 |
|
... |
|
}; |
When target: 'node' I suspect the default for externalsPresets will be { node: true }:
https://github.com/webpack/webpack/blob/88978167ea2ee438761179dbbe2e21233dc9d34d/lib/config/defaults.js#L905
Therefore I'm not sure we need to set externalsPresets when target: 'node'?
Regarding this part of the docs:
webpack-node-externals/README.md
Lines 32 to 44 in fc08261
When
target: 'node'I suspect the default forexternalsPresetswill be{ node: true }:https://github.com/webpack/webpack/blob/88978167ea2ee438761179dbbe2e21233dc9d34d/lib/config/defaults.js#L905
Therefore I'm not sure we need to set
externalsPresetswhentarget: 'node'?