Skip to content

Do we need to set externalsPresets when target: 'node'?Β #116

@OliverJAsh

Description

@OliverJAsh

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'?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions