const merge = require('webpack-merge').merge; const CleanWebpackPlugin = require('clean-webpack-plugin').CleanWebpackPlugin; const ESLintPlugin = require('eslint-webpack-plugin'); const TerserWebpackPlugin = require('terser-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const ProgressBarWebpackPlugin = require('progress-bar-webpack-plugin'); const path = require('path'); const common = require('./webpack.config.js'); const resolve = (url) => path.resolve(__dirname, "..", url); module.exports = merge(common, { mode: 'production', devtool: 'source-map', plugins: [ new CleanWebpackPlugin(), new ESLintPlugin({ overrideConfigFile: resolve(".eslintrc.js"), context: resolve("src"), extensions: ['ts', 'js'], fix: true, }), new ProgressBarWebpackPlugin(), new HtmlWebpackPlugin({ template: './index.html', title: 'luckysheet-io', scriptLoading: 'blocking', }), ], optimization: { minimize: true, minimizer: [ new TerserWebpackPlugin({ terserOptions: { format: { comments: false, }, }, extractComments: false, }), ], }, output: { filename: 'js/[name].js', libraryTarget: 'umd', library: 'luckysheet-io', path: resolve('dist'), }, });