Commit 67541ec4 authored by Vasily Belolapotkov's avatar Vasily Belolapotkov

update webpack to minify build

parent 77449b2c
Pipeline #53272622 passed with stages
in 1 minute and 22 seconds
......@@ -6937,6 +6937,30 @@
}
}
},
"uglifyjs-webpack-plugin": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-2.1.2.tgz",
"integrity": "sha512-G1fJx2uOAAfvdZ77SVCzmFo6mv8uKaHoZBL9Qq/ciC8r6p0ANOL1uY85fIUiyWXKw5RzAaJYZfNSL58Or2hQ0A==",
"dev": true,
"requires": {
"cacache": "11.3.2",
"find-cache-dir": "2.0.0",
"schema-utils": "1.0.0",
"serialize-javascript": "1.6.1",
"source-map": "0.6.1",
"uglify-js": "3.4.9",
"webpack-sources": "1.3.0",
"worker-farm": "1.6.0"
},
"dependencies": {
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true
}
}
},
"union-value": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz",
......
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const isProduction = process.env.NODE_ENV === 'production';
if (isProduction) {
console.log('[Webpack] Building for production');
}
module.exports = {
mode: isProduction ? 'production' : 'development',
entry: './src/index.ts',
......@@ -17,8 +22,8 @@ module.exports = {
new HtmlWebpackPlugin({
title: 'Telegram contest app',
meta: {
viewport: 'width=device-width, initial-scale=1, shrink-to-fit=no'
}
viewport: 'width=device-width, initial-scale=1, shrink-to-fit=no',
},
}),
],
......@@ -39,7 +44,7 @@ module.exports = {
},
{
test: /\.svg$/,
loader: 'svg-inline-loader'
loader: 'svg-inline-loader',
},
],
},
......@@ -52,4 +57,10 @@ module.exports = {
filename: 'main.js',
path: path.resolve(__dirname, 'dist'),
},
optimization: isProduction
? {
minimizer: [new UglifyJsPlugin()],
}
: {},
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment