{"size": 745, "ext": "js", "max_stars_repo_path": "lib/core/src/server/preview/babel-loader-preview.js", "max_stars_repo_name": "campelo/storybook", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "lib/core/src/server/preview/babel-loader-preview.js", "max_issues_repo_name": "campelo/storybook", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lib/core/src/server/preview/babel-loader-preview.js", "max_forks_repo_name": "campelo/storybook", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 20.6944444444, "max_line_length": 74, "alphanum_fraction": 0.5355704698}
import { includePaths, excludePaths } from '../config/utils';
import { plugins } from '../common/babel';

export const createBabelLoader = (options) => ({
  test: /\.(mjs|jsx?)$/,
  use: [
    {
      loader: 'babel-loader',
      options,
    },
  ],
  include: includePaths,
  exclude: excludePaths,
});

export const es6ModulesRule = {
  test: /\.js$/,
  use: [
    {
      loader: require.resolve('babel-loader'),
      options: {
        sourceType: 'unambiguous',
        presets: [
          [
            require.resolve('@babel/preset-env'),
            { shippedProposals: true, useBuiltIns: 'usage', corejs: '3' },
          ],
        ],
        plugins,
      },
    },
  ],
  include: [/node_modules/],
  exclude: excludePaths,
};
