Include and Exclude in Webpack Loader

Kinda surprises me.

Exclude and Include DO NOT support relative path.

Here is the detail from doc.


A array of automatically applied loaders.

Each item can have these properties:

test: A condition that must be met exclude: A condition that must not be met include: A condition that must be met loader: A string of "!" separated loaders loaders: A array of loaders as string

A condition can be a RegExp, an absolute path start, or an array of one of these combined with "and".

RegExp example

exclude: [/bower_components/, /node_modules/]

Performance tip

Use exclude and include properly, since Webpack is likely traveling through the files in the project.