<commit_before>'use strict';

var hopsConfig = require('../..');

function createIdentifier (targets) {
  return JSON.stringify({
    env: process.env.NODE_ENV + ',' + process.env.BABEL_ENV,
    version: require('../../package.json').version,
    targets: targets
  });
}

function getBabelLoader (targets, plugins) {
  return {
    test: /\.m?jsx?$/,
    use: {
      loader: require.resolve('babel-loader'),
      options: {
        cacheDirectory: true,
        cacheIdentifier: createIdentifier(targets),
        presets: [
          [
            'env',
            {
              modules: false,
              useBuiltIns: true,
              targets: targets
            }
          ],
          'react'
        ],
        plugins: [].concat(plugins || [], [
          'flow-react-proptypes',
          'transform-class-properties',
          'transform-object-rest-spread'
        ])
      }
    },
    include: require('../../lib/check-esnext')
  };
}

exports.default = getBabelLoader(
  { browsers: hopsConfig.browsers },
  'syntax-dynamic-import'
);

exports.node = getBabelLoader(
  { node: 'current' },
  'dynamic-import-node'
);<commit_msg>fix(hops-config): use hops relative babel plugins packages<commit_after>'use strict';

var hopsConfig = require('../..');

function createIdentifier (targets) {
  return JSON.stringify({
    env: process.env.NODE_ENV + ',' + process.env.BABEL_ENV,
    version: require('../../package.json').version,
    targets: targets
  });
}

function getBabelLoader (targets, plugins) {
  return {
    test: /\.m?jsx?$/,
    use: {
      loader: require.resolve('babel-loader'),
      options: {
        cacheDirectory: true,
        cacheIdentifier: createIdentifier(targets),
        presets: [
          [
            'env',
            {
              modules: false,
              useBuiltIns: true,
              targets: targets
            }
          ],
          'react'
        ],
        plugins: [].concat(plugins || [], [
          require.resolve('babel-plugin-flow-react-proptypes'),
          require.resolve('babel-plugin-transform-class-properties'),
          require.resolve('babel-plugin-transform-object-rest-spread')
        ])
      }
    },
    include: require('../../lib/check-esnext')
  };
}

exports.default = getBabelLoader(
  { browsers: hopsConfig.browsers },
  require.resolve('babel-plugin-syntax-dynamic-import')
);

exports.node = getBabelLoader(
  { node: 'current' },
  require.resolve('babel-plugin-dynamic-import-node')
);
{'fraction_non_alphanumeric': 0.15516553649780615, 'fraction_numerical': 0.0, 'mean_word_length': 2.1232876712328768, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4255566', 'n_tokens_mistral': 757, 'n_tokens_neox': 734, 'n_words': 122}