/*
 * @Author: wangdengzhi
 * @Date: 2020-08-19 15:33:16
 * @Last Modified by: wangdengzhi
 * @Last Modified time: 2020-08-24 09:18:55
 * @description: 生产配置，将example文件和template打包到dist，生成可访问文件，给android使用
 */
const { merge } = require('webpack-merge');
const common = require('./webpack.common');
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');

module.exports = merge(common, {
  entry: {
    app: path.resolve(__dirname, '../../page/android/index.tsx'),
  },
  devtool: 'source-map',
  mode: 'production',
  plugins: [
    new webpack.DefinePlugin({
      webpack_theme: JSON.stringify('android'),
    }),
    new HtmlWebpackPlugin({
      template: path.resolve(__dirname, '../../template/index.html'),
      filename: path.resolve(__dirname, '../../dist/index.html'),
      chunks: ['app', 'common'],
    }),
  ],
});
