/*
 * @Author: wangdengzhi
 * @Date: 2020-08-19 15:34:10
 * @Last Modified by: Demian
 * @Last Modified time: 2020-08-24 06:36:24
 * @description：生产配置，将src文件打包到dist目录，用于npm包发包。发布成react组件，给web项目使用
 */
const { merge } = require('webpack-merge');
const common = require('./webpack.common');
const path = require('path');
const webpack = require('webpack');

module.exports = merge(common, {
  entry: path.resolve(__dirname, '../../src/index.tsx'),
  output: {
    filename: 'index.js',
    path: path.resolve(__dirname, '../../dist'),
    libraryTarget: 'umd', // 第三方React组件，打成UMD格式的包
  },
  externals: ['react', 'classname', 'react-dom'],
  devtool: false,
  mode: 'development',
  plugins: [
    new webpack.DefinePlugin({
      webpack_theme: JSON.stringify('teacher'),
    }),
  ],
});
