Skip to content
This repository was archived by the owner on Sep 21, 2021. It is now read-only.

Commit 0be6a6b

Browse files
ahuthjasonLaster
authored andcommitted
Add babelExcludes to webpack.config.js
1 parent 53cfa2a commit 0be6a6b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

packages/devtools-launchpad/webpack.config.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,18 @@ module.exports = (webpackConfig, envConfig, options = {}) => {
3434
let excludedRe = new RegExp(`(${excludedPaths.join("|")})`);
3535
let excluded = !!request.match(excludedRe);
3636

37-
if (options && options.babelExcludes) {
37+
if (options.babelExcludes) {
3838
// If the tool defines an additional exclude regexp for Babel.
3939
excluded = excluded || !!request.match(options.babelExcludes);
4040
}
41-
return excluded && !request.match(/node_modules(\/|\\)devtools-/);
41+
42+
let included = ["devtools-"]
43+
if (options.babelIncludes) {
44+
included = included.concat(options.babelIncludes);
45+
}
46+
47+
const reincludeRe = new RegExp(`node_modules(\\/|\\\\)${included.join("|")}`);
48+
return excluded && !request.match(reincludeRe);
4249
},
4350
loader: `babel-loader?ignore=src/lib`
4451
});

0 commit comments

Comments
 (0)