From 696653016515ff51f5c24d6df9878a3d23101a7d Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sun, 22 Dec 2019 00:16:13 -0800 Subject: [PATCH] Better redux devtooling support --- package.json | 1 + resources/scripts/state/server/index.ts | 8 +++++++- webpack.config.js | 2 +- yarn.lock | 4 ++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e53ac2a13..c3e89969c 100644 --- a/package.json +++ b/package.json @@ -91,6 +91,7 @@ "postcss-preset-env": "^6.7.0", "precss": "^4.0.0", "purgecss-webpack-plugin": "^1.6.0", + "redux-devtools-extension": "^2.13.8", "resolve-url-loader": "^3.0.0", "source-map-loader": "^0.2.4", "style-loader": "^0.23.1", diff --git a/resources/scripts/state/server/index.ts b/resources/scripts/state/server/index.ts index 334b7b493..8fc23aee5 100644 --- a/resources/scripts/state/server/index.ts +++ b/resources/scripts/state/server/index.ts @@ -4,6 +4,7 @@ import socket, { SocketStore } from './socket'; import { ServerDatabase } from '@/api/server/getServerDatabases'; import files, { ServerFileStore } from '@/state/server/files'; import subusers, { ServerSubuserStore } from '@/state/server/subusers'; +import { composeWithDevTools } from 'redux-devtools-extension'; export type ServerStatus = 'offline' | 'starting' | 'stopping' | 'running'; @@ -88,4 +89,9 @@ export const ServerContext = createContextStore({ state.socket.instance = null; state.socket.connected = false; }), -}, { name: 'ServerStore' }); +}, { + compose: composeWithDevTools({ + name: 'ServerStore', + trace: true, + }), +}); diff --git a/webpack.config.js b/webpack.config.js index 9d1fc731d..f5c050c68 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -50,7 +50,7 @@ module.exports = { cache: true, target: 'web', mode: process.env.NODE_ENV, - devtool: isProduction ? false : 'eval-source-map', + devtool: isProduction ? false : process.env.DEVTOOL || 'source-map', performance: { hints: false, }, diff --git a/yarn.lock b/yarn.lock index 9ba396b2a..f46c2f81f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6136,6 +6136,10 @@ readdirp@^2.2.1: micromatch "^3.1.10" readable-stream "^2.0.2" +redux-devtools-extension@^2.13.8: + version "2.13.8" + resolved "https://registry.yarnpkg.com/redux-devtools-extension/-/redux-devtools-extension-2.13.8.tgz#37b982688626e5e4993ff87220c9bbb7cd2d96e1" + redux-thunk@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/redux-thunk/-/redux-thunk-2.3.0.tgz#51c2c19a185ed5187aaa9a2d08b666d0d6467622"