<commit_before>const helpers = require('./helpers')
const path = require('path')

const HtmlWebpackPlugin = require('html-webpack-plugin')
const TerserPlugin = require('terser-webpack-plugin')
const ProvidePlugin = require('webpack/lib/ProvidePlugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')

module.exports = function () {
  const configuration = {
    entry: {
      'video-embed': './src/standalone/videos/embed.ts',
      'player': './src/standalone/player/player.ts',
      'test-embed': './src/standalone/videos/test-embed.ts'
    },

    resolve: {
      /*
       * An array of extensions that should be used to resolve modules.
       *
       * See: http://webpack.github.io/docs/configuration.html#resolve-extensions
       */
      extensions: [ '.ts', '.js', '.json', '.scss' ],

      modules: [ helpers.root('src'), 'node_modules' ],

      alias: {
        'video.js$': path.resolve('node_modules/video.js/core.js'),
        'hls.js$': path.resolve('node_modules/hls.js/dist/hls.light.js'),
        '@root-helpers': path.resolve('src/root-helpers'),
        '@shared/models': path.resolve('../shared/models'),
        '@shared/core-utils': path.resolve('../shared/core-utils')
      },

      fallback: {
        fs: [ path.resolve('src/shims/noop.ts') ],
        http: [ path.resolve('src/shims/http.ts') ],
        https: [ path.resolve('src/shims/https.ts') ],
        path: [ path.resolve('src/shims/path.ts') ],
        stream: [ path.resolve('src/shims/stream.ts') ],
        crypto: [ path.resolve('src/shims/noop.ts') ]
      }
    },

    output: {
      path: helpers.root('dist/standalone/videos'),

      filename: process.env.ANALYZE_BUNDLE === 'true'
        ? '[name].bundle.js'
        : '[name].[contenthash].bundle.js',

      sourceMapFilename: '[file].map',

      chunkFilename: process.env.ANALYZE_BUNDLE === 'true'
        ? '[name].chunk.js'
        : '[id].[contenthash].chunk.js',

      publicPath: '/client/standalone/videos/'
    },

    devtool: process.env.NODE_ENV === 'production' ? false : 'source-map',

    module: {

      rules: [
        {
          test: /\.ts$/,
          use: [
            {
              loader: 'ts-loader',
              options: {
                configFile: helpers.root('tsconfig.json')
              }
            }
          ]
        },
        {
          test: /\.js$/,
          use: [
            {
              loader: 'babel-loader',
              options: {
                presets: [
                  [
                    '@babel/preset-env', {
                      targets: 'last 1 Chrome version, last 2 Edge major versions, Firefox ESR, Safari >= 11, ios_saf >= 11'
                    }
                  ]
                ]<commit_msg>Fix babel for mjs files<commit_after>const helpers = require('./helpers')
const path = require('path')

const HtmlWebpackPlugin = require('html-webpack-plugin')
const TerserPlugin = require('terser-webpack-plugin')
const ProvidePlugin = require('webpack/lib/ProvidePlugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')

module.exports = function () {
  const configuration = {
    entry: {
      'video-embed': './src/standalone/videos/embed.ts',
      'player': './src/standalone/player/player.ts',
      'test-embed': './src/standalone/videos/test-embed.ts'
    },

    resolve: {
      /*
       * An array of extensions that should be used to resolve modules.
       *
       * See: http://webpack.github.io/docs/configuration.html#resolve-extensions
       */
      extensions: [ '.ts', '.js', '.json', '.scss' ],

      modules: [ helpers.root('src'), 'node_modules' ],

      alias: {
        'video.js$': path.resolve('node_modules/video.js/core.js'),
        'hls.js$': path.resolve('node_modules/hls.js/dist/hls.light.js'),
        '@root-helpers': path.resolve('src/root-helpers'),
        '@shared/models': path.resolve('../shared/models'),
        '@shared/core-utils': path.resolve('../shared/core-utils')
      },

      fallback: {
        fs: [ path.resolve('src/shims/noop.ts') ],
        http: [ path.resolve('src/shims/http.ts') ],
        https: [ path.resolve('src/shims/https.ts') ],
        path: [ path.resolve('src/shims/path.ts') ],
        stream: [ path.resolve('src/shims/stream.ts') ],
        crypto: [ path.resolve('src/shims/noop.ts') ]
      }
    },

    output: {
      path: helpers.root('dist/standalone/videos'),

      filename: process.env.ANALYZE_BUNDLE === 'true'
        ? '[name].bundle.js'
        : '[name].[contenthash].bundle.js',

      sourceMapFilename: '[file].map',

      chunkFilename: process.env.ANALYZE_BUNDLE === 'true'
        ? '[name].chunk.js'
        : '[id].[contenthash].chunk.js',

      publicPath: '/client/standalone/videos/'
    },

    devtool: process.env.NODE_ENV === 'production' ? false : 'source-map',

    module: {

      rules: [
        {
          test: /\.ts$/,
          use: [
            {
              loader: 'ts-loader',
              options: {
                configFile: helpers.root('tsconfig.json')
              }
            }
          ]
        },
        {
          test: /\.m?js$/,
          use: [
            {
              loader: 'babel-loader',
              options: {
                presets: [
                  [
                    '@babel/preset-env', {
                      targets: 'last 1 Chrome version, last 2 Edge major versions, Firefox ESR, Safari >= 11, ios_saf >= 11'
                    }
                  ]
                ]
{'fraction_non_alphanumeric': 0.17003975424647633, 'fraction_numerical': 0.0021684134441633538, 'mean_word_length': 1.8604651162790697, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1196848', 'n_tokens_mistral': 1751, 'n_tokens_neox': 1681, 'n_words': 266}