src/configure-webpack/loaders/javascript.js
function buildExcludeCheck (transpileDependencies = []) {
  const dependencyChecks = transpileDependencies.map((dependency) => (
    new RegExp(`node_modules.${dependency}`)
  ))

  // see: https://webpack.js.org/configuration/module/#condition
  return function (assetPath) {
    const shouldTranspile = dependencyChecks
      .reduce((result, check) => result || assetPath.match(check), false)

    if (shouldTranspile) { return false }
    return !!assetPath.match(/node_modules/)
  }
}
function buildExcludeCheck (transpileDependencies = []) {
  const dependencyChecks = transpileDependencies.map((dependency) => (
    new RegExp(`node_modules.${dependency}`)
  ))

  // see: https://webpack.js.org/configuration/module/#condition
  return function (assetPath) {
    const shouldTranspile = dependencyChecks
      .reduce((result, check) => result || assetPath.match(check), false)

    if (shouldTranspile) { return false }
    return !!assetPath.match(/node_modules/)
  }
}
function buildExcludeCheck ( transpileDependencies = [ ] ) { const dependencyChecks = transpileDependencies . map ( ( dependency ) => ( new RegExp ( ` ${ dependency } ` ) ) ) // see: https://webpack.js.org/configuration/module/#condition return function ( assetPath ) { const shouldTranspile = dependencyChecks . reduce ( ( result , check ) => result || assetPath . match ( check ) , false ) if ( shouldTranspile ) { return false } return ! ! assetPath . match ( / node_modules / ) } }
Take into consideration if the user wants any dependency
to be transpiled with Babel and returns an exclude check
function that can be used by Webpack
Take into consideration if the user wants any dependency to be transpiled with Babel and returns an exclude check function that can be used by Webpack