Getting Started with webpack
Drew Powers
2.3K46

You can use include as well to make the opposite[to exclude] exception (but you usually won’t need this option)

Include will not make an “exception” to test. Include condition won’t override test condition (unlike exclude) — both test and&& include must be matched.

So docs recommend to use test to provide regex(s) to match filenames or extensions, while include should be used together with test to provide string(path) to, presumably, your source folder. Note that path must be absolute, cause string condition is matched when source’s path begins with given string.

test: /\.jsx?$/,
include: [
path.resolve(__dirname, "app")
]

this way all .jsx files only inside your “app” directory will be used. Nothing else will be “mangled”

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.