Add compression

This commit is contained in:
Paulo Gustavo Veiga 2021-02-16 01:15:04 -08:00
parent 3b7b5a95d7
commit db63c7688e
7 changed files with 32 additions and 16 deletions

View File

@ -15,15 +15,12 @@
"license": "MIT",
"private": false,
"devDependencies": {
"@babel/preset-env": "^7.12.7",
"@babel/preset-react": "^7.12.7",
"@formatjs/cli": "^2.13.15",
"@typescript-eslint/eslint-plugin": "^4.8.1",
"@typescript-eslint/parser": "^4.8.1",
"babel-loader": "^8.2.2",
"babel-plugin-transform-imports": "^2.0.0",
"brotli-webpack-plugin": "^1.1.0",
"clean-webpack-plugin": "^3.0.0",
"compression-webpack-plugin": "^7.1.2",
"copy-webpack-plugin": "^7.0.0",
"css-loader": "^5.0.1",
"eslint": "^7.14.0",

View File

@ -1,4 +1,4 @@
import { FormControl, FormControlLabel, FormGroup, FormHelperText, FormLabel, Switch } from "@material-ui/core";
import { FormControl, FormControlLabel, FormGroup, Switch } from "@material-ui/core";
import React, { useEffect } from "react";
import { FormattedMessage, useIntl } from "react-intl";
import { useMutation, useQueryClient } from "react-query";

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
"sourceMap": true,
"noImplicitAny": false,
"module": "commonjs",
"target": "es5",
"target": "es6",
"jsx": "react",
"allowJs": true,
"esModuleInterop": true

View File

@ -1,7 +1,7 @@
const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const CompressionPlugin = require('compression-webpack-plugin');
module.exports = {
@ -29,10 +29,6 @@ module.exports = {
},
]
},
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
},
plugins: [
new CleanWebpackPlugin(),
new CopyWebpackPlugin({
@ -45,7 +41,7 @@ module.exports = {
]
}
}]
})
}),
new CompressionPlugin()
]
}

View File

@ -17,6 +17,10 @@ module.exports = merge(common, {
]
}
},
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
},
plugins: [
new HtmlWebpackPlugin({
template: path.join(__dirname, 'public/index.html'),

View File

@ -1,11 +1,31 @@
const { merge } = require('webpack-merge');
const common = require('./webpack.common.js');
const path = require('path');
module.exports = merge(common, {
mode: 'production',
devtool: 'source-map',
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist')
},
optimization: {
minimize: true,
usedExports: true
},
usedExports: true,
splitChunks: {
cacheGroups: {
vendors: {
test: /node_modules\/(?!antd\/).*/,
name: "vendors",
chunks: "all",
},
// This can be your own design library.
antd: {
test: /node_modules\/(antd\/).*/,
name: "antd",
chunks: "all",
},
},
}
}
});