From 8ea4f56b23fb2b53dd7072d80789d072f6f53bb4 Mon Sep 17 00:00:00 2001 From: Rufat Aliyev <46456022+rufataliy@users.noreply.github.com> Date: Tue, 2 Feb 2021 14:42:24 -0500 Subject: [PATCH 1/4] Removed host prop from dev config of webpack. It will serve to localhost by default. IP addresses for local host for MacOS and Win are not the same. If you want to specify host add it like a string 'localhost' --- client/webpack.dev.js | 1 - 1 file changed, 1 deletion(-) diff --git a/client/webpack.dev.js b/client/webpack.dev.js index 5011b791a..53fb3d8a2 100644 --- a/client/webpack.dev.js +++ b/client/webpack.dev.js @@ -9,7 +9,6 @@ module.exports = merge(config, { contentBase: './public', compress: true, port: 3000, - host: '0.0.0.0', hot: true, historyApiFallback: true, }, From 966a1a392053d41758a5e554dadd18e569a85df1 Mon Sep 17 00:00:00 2001 From: Rufat Aliyev <46456022+rufataliy@users.noreply.github.com> Date: Tue, 2 Feb 2021 14:45:46 -0500 Subject: [PATCH 2/4] Added to writeToDisk option to dev server. If not server will try to copy social-media-card-image.png from public to dist which didn't exist and caused looping which resulted in High CPU usage. --- client/webpack.dev.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/webpack.dev.js b/client/webpack.dev.js index 53fb3d8a2..f01cb221b 100644 --- a/client/webpack.dev.js +++ b/client/webpack.dev.js @@ -1,12 +1,15 @@ const merge = require('webpack-merge'); const config = require('./webpack.config.js'); +const path = require("path") module.exports = merge(config, { mode: 'development', devtool: 'inline-source-map', devServer: { open: true, - contentBase: './public', + contentBase: path.join(__dirname,'./dist'), + publicPath:"/", + writeToDisk: true, compress: true, port: 3000, hot: true, From 077b5a64f422c81ff82355331dcfa0c53e7cfae4 Mon Sep 17 00:00:00 2001 From: Rufat Aliyev <46456022+rufataliy@users.noreply.github.com> Date: Tue, 2 Feb 2021 14:46:34 -0500 Subject: [PATCH 3/4] Added watch option to ignore node modules --- client/webpack.config.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/webpack.config.js b/client/webpack.config.js index 40cd73ec6..de783261c 100644 --- a/client/webpack.config.js +++ b/client/webpack.config.js @@ -12,6 +12,9 @@ module.exports = { path: path.join(__dirname, '/dist'), filename: 'bundle.js', }, + watchOptions: { + ignored: /node_modules/ + }, resolve: { extensions: ['.js', '.jsx'], alias: { From 71ed17916cae066ce5d2fdf39f9ea4c061163ba1 Mon Sep 17 00:00:00 2001 From: Rufat Aliyev <46456022+rufataliy@users.noreply.github.com> Date: Tue, 2 Feb 2021 15:07:00 -0500 Subject: [PATCH 4/4] Linted --- client/webpack.config.js | 2 +- client/webpack.dev.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/webpack.config.js b/client/webpack.config.js index de783261c..afc572dea 100644 --- a/client/webpack.config.js +++ b/client/webpack.config.js @@ -13,7 +13,7 @@ module.exports = { filename: 'bundle.js', }, watchOptions: { - ignored: /node_modules/ + ignored: /node_modules/, }, resolve: { extensions: ['.js', '.jsx'], diff --git a/client/webpack.dev.js b/client/webpack.dev.js index f01cb221b..6f1928fc1 100644 --- a/client/webpack.dev.js +++ b/client/webpack.dev.js @@ -1,14 +1,14 @@ const merge = require('webpack-merge'); +const path = require('path'); const config = require('./webpack.config.js'); -const path = require("path") module.exports = merge(config, { mode: 'development', devtool: 'inline-source-map', devServer: { open: true, - contentBase: path.join(__dirname,'./dist'), - publicPath:"/", + contentBase: path.join(__dirname, './dist'), + publicPath: '/', writeToDisk: true, compress: true, port: 3000,