Skip to content

Commit

Permalink
use callback instead of regex for babel exclude (#671)
Browse files Browse the repository at this point in the history
  • Loading branch information
jchip authored Jan 12, 2018
1 parent 0aa0f37 commit ad6944c
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ const _ = require("lodash");
const logger = require("electrode-archetype-react-app/lib/logger");

module.exports = function(options) {
// regex \b for word boundaries
const babelExcludeRegex = new RegExp(
`(node_modules|\\b${Path.join(AppMode.src.client, "vendor")}\\b)`
);
const clientVendor = Path.join(AppMode.src.client, "vendor/");
const babelExclude = x => {
if (x.indexOf("/node_modules") >= 0) return true;
if (x.indexOf(clientVendor) >= 0) return true;
return false;
};

const babelLoader = {
_name: "babel",
test: /\.jsx?$/,
exclude: babelExcludeRegex,
exclude: babelExclude,
use: [
options.HotModuleReload && "react-hot-loader",
{
Expand Down

0 comments on commit ad6944c

Please sign in to comment.