{"size": 1147, "ext": "js", "max_stars_repo_path": "framework/react/webpack-ts/dev-config/webpack.config.umd.js", "max_stars_repo_name": "zouv/frontend-boilerplates", "max_stars_repo_stars_event_min_datetime": "2020-05-17T07:56:01.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-25T15:02:06.000Z", "max_issues_repo_path": "homepage/dev-config/webpack.config.umd.js", "max_issues_repo_name": "ng-tech-edu/xCompass", "max_issues_repo_issues_event_min_datetime": "2021-01-28T19:57:57.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-02T20:02:50.000Z", "max_forks_repo_path": "homepage/dev-config/webpack.config.umd.js", "max_forks_repo_name": "ng-tech-edu/xCompass", "max_forks_repo_forks_event_min_datetime": "2021-03-04T14:31:43.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-16T08:18:22.000Z"}
{"max_stars_count": 31, "max_issues_count": 34, "max_forks_count": 5, "avg_line_length": 22.4901960784, "max_line_length": 78, "alphanum_fraction": 0.5989537925}
const path = require('path');

const prodConfig = require('./webpack.config.prod');
const { libraryName, libraryEntry = 'index.js' } = require('../package.json');

const PATHS = {
  src: path.join(__dirname, '../src'),
  build: path.join(__dirname, '../build')
};

const umdConfig = {
  ...prodConfig,
  entry: path.join(PATHS.src, libraryEntry),
  output: {
    filename: '[name].umd.js',
    path: PATHS.build,
    sourceMapFilename: '[name].map',
    library: libraryName,
    libraryTarget: 'umd'
  },
  resolve: {
    alias: {
      react: path.resolve(__dirname, './node_modules/react'),
      'react-dom': path.resolve(__dirname, './node_modules/react-dom')
    }
  },
  externals: {
    // Don't bundle react or react-dom
    react: {
      commonjs: 'react',
      commonjs2: 'react',
      amd: 'React',
      root: 'React'
    },
    'react-dom': {
      commonjs: 'react-dom',
      commonjs2: 'react-dom',
      amd: 'ReactDOM',
      root: 'ReactDOM'
    },
    'styled-components': {
      commonjs: 'styled-components',
      commonjs2: 'styled-components'
    }
  }
};

delete umdConfig.optimization;

module.exports = umdConfig;
