Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] do I need to add exclude section to loaders with this library? #63

Closed
andykais opened this issue May 15, 2019 · 1 comment
Closed

Comments

@andykais
Copy link

Hi, I have a broad question about how this library works. If I use webpack-node-externals like so:

const nodeExternals = require('webpack-node-externals')
module.exports {
  ...
  externals: [nodeExternals()]
}

what does it actually do? The webpack documentation states

The externals configuration option provides a way of excluding dependencies from the output bundles

What I want to know, is if this also prevents anything in the node_modules folder from reaching the loaders. A lot of loaders recommend adding an exclude: /node_modules/ section to prevent node_modules from being transpiled (babel-loader, awesome-typescript-loader, istanbul-instrumenter-loader, etc). I want to know if this step is necessary provided we are already using webpack-node-externals.

@liady
Copy link
Owner

liady commented Jul 8, 2020

Yes, the loaders configuration is not affected by this plugin. This plugin merely prevents dependencies (i.e node_modules) from being bundled - and it is used mainly when bundling code as a node library.
(since in a node environment you do not need to bundle your dependencies)

@liady liady closed this as completed Jul 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants