if (DevMode === "optimizations") {
return {
entry: {
front: './src/index.tsx',
},
resolve: {
extensions: ['.ts', '.tsx', '.js']
},
output: {
path: __dirname + '/build',
filename: '[name].js'
},
module: {
rules: [{
test: /\.tsx?$/,
loader: 'awesome-typescript-loader'
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{ test: /\.(jpe?g|png|gif|svg|webp)$/i, loader: 'url-loader?name=app/images/[name].[ext]' },
{
test: /\.styl$/,
use: [{
loader: MiniCssExtractPlugin.loader,
options: { publicPath: '/dist' }
},
{ loader: 'css-loader' },
{ loader: 'stylus-loader' }
]
}
]
},
optimization: {
minimize: true,
minimizer: [new TerserPlugin()],
},
plugins: [
new HtmlWebpackPlugin({
template: './public/index.html'
}),
new MiniCssExtractPlugin({
filename: '[name].css',
chunkFilename: '[id].css'
}),
new WebpackBar(),
new ImageminPlugin({
pngquant: {
quality: '95-100'
}
}),
new OptimizeCSSAssetsPlugin({})
]
}
}