From 6694e353ad1119df11a9afb0ea2ad6fb42c77d4b Mon Sep 17 00:00:00 2001 From: schmelczerandras Date: Thu, 22 Oct 2020 16:58:10 +0200 Subject: [PATCH] Fix mismatching function names --- backend/package.json | 8 +++++--- frontend/package.json | 1 + frontend/webpack.config.js | 12 ++++++++++++ shared/webpack.config.js | 24 ++++++++++++------------ 4 files changed, 30 insertions(+), 15 deletions(-) diff --git a/backend/package.json b/backend/package.json index e43041c..df69177 100644 --- a/backend/package.json +++ b/backend/package.json @@ -6,7 +6,7 @@ "author": "AndrĂ¡s Schmelczer (https://schmelczer.dev/)", "main": "dist/main.js", "bin": { - "declared-server": "dist/main.js" + "declared-server": "./dist/main.js" }, "scripts": { "build": "npx webpack --mode production", @@ -39,16 +39,18 @@ "eslint-plugin-prettier": "^3.1.4", "eslint-plugin-unused-imports": "^0.1.3", "file-loader": "^6.1.0", + "html-webpack-plugin": "^4.5.0", "nodemon": "^2.0.4", "prettier": "^2.0.5", "raw-loader": "^4.0.1", "resolve-url-loader": "^3.1.1", "terser-webpack-plugin": "^2.3.5", + "ts-config-webpack-plugin": "^2.0.0", "ts-loader": "^8.0.3", "typescript": "^4.0.3", - "webpack": "^4.43.0", + "webpack": "^4.44.2", "webpack-cli": "^3.3.12", - "webpack-dev-server": "^3.10.3", + "webpack-dev-server": "^3.11.0", "webpack-node-externals": "^2.5.2" } } diff --git a/frontend/package.json b/frontend/package.json index cba13eb..d4434c2 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -40,6 +40,7 @@ "sdf-2d": "^0.6.0", "socket.io-client": "^2.3.1", "source-map-loader": "^1.1.1", + "terser-webpack-plugin": "^4.2.2", "ts-config-webpack-plugin": "^2.0.0", "typescript": "^4.0.3", "webpack": "^4.43.0", diff --git a/frontend/webpack.config.js b/frontend/webpack.config.js index 23196f2..642317d 100644 --- a/frontend/webpack.config.js +++ b/frontend/webpack.config.js @@ -3,6 +3,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin'); const ScssConfigWebpackPlugin = require('scss-config-webpack-plugin'); const TsConfigWebpackPlugin = require('ts-config-webpack-plugin'); const HtmlWebpackInlineSVGPlugin = require('html-webpack-inline-svg-plugin'); +const TerserJSPlugin = require('terser-webpack-plugin'); module.exports = { devServer: { @@ -34,6 +35,17 @@ module.exports = { // see https://github.com/namics/webpack-config-plugins/tree/master/packages/ts-config-webpack-plugin/config new TsConfigWebpackPlugin(), ], + optimization: { + minimizer: [ + new TerserJSPlugin({ + test: /\.js$/, + exclude: /node_modules/, + terserOptions: { + keep_classnames: true, + }, + }), + ], + }, module: { rules: [ { diff --git a/shared/webpack.config.js b/shared/webpack.config.js index 2eebc06..20fa930 100644 --- a/shared/webpack.config.js +++ b/shared/webpack.config.js @@ -1,4 +1,7 @@ const path = require('path'); +const CleanWebpackPlugin = require('clean-webpack-plugin').CleanWebpackPlugin; +const HtmlWebpackPlugin = require('html-webpack-plugin'); +const TsConfigWebpackPlugin = require('ts-config-webpack-plugin'); const PATHS = { entryPoint: path.resolve(__dirname, 'src/main.ts'), @@ -27,18 +30,15 @@ module.exports = (env, argv) => ({ optimization: { minimize: false, }, - plugins: [], - module: { - rules: [ - { - test: /\.ts$/, - use: { - loader: 'ts-loader', - }, - exclude: /node_modules/, - }, - ], - }, + plugins: [ + // Cleans the dist folder before the build starts + new CleanWebpackPlugin(), + // Generate a base html file and injects all generated css and js files + new HtmlWebpackPlugin(), + // Multi threading typescript loader configuration with caching for .ts and .tsx files + // see https://github.com/namics/webpack-config-plugins/tree/master/packages/ts-config-webpack-plugin/config + new TsConfigWebpackPlugin(), + ], resolve: { extensions: ['.ts'], },