From 164560c1207da1e863ab8659a2a488c42efea746 Mon Sep 17 00:00:00 2001 From: Karlatemp Date: Fri, 28 Jun 2024 19:11:43 +0800 Subject: [PATCH] dev build --- config-overrides.js | 7 +++++++ package.json | 2 ++ yarn.lock | 9 ++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/config-overrides.js b/config-overrides.js index 080e783..24fec3f 100644 --- a/config-overrides.js +++ b/config-overrides.js @@ -13,6 +13,13 @@ const CopyPlugin = require("copy-webpack-plugin"); module.exports = { webpack: override( + (config) => { + if (process.env.DEV_MODE) { + config.mode = 'development'; + config.optimization.minimize = false; + } + return config; + }, addLessLoader({ lessLoaderOptions: { lessOptions: {}, diff --git a/package.json b/package.json index 338a080..2880219 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "start": "react-app-rewired start", "dev": "react-app-rewired start", "build": "react-app-rewired build", + "build:dev": "cross-env DEV_MODE=true react-app-rewired build", "eject": "react-scripts eject", "eslint": "eslint src/ --ext .ts,.tsx,.js,.jsx --fix --cache", "stylelint": "stylelint \"src/**/*.less\" \"src/**/*.css\" --fix --cache", @@ -47,6 +48,7 @@ "@types/react-dom": "^17.0.0", "@typescript-eslint/eslint-plugin": "^5.4.0", "@typescript-eslint/parser": "^5.4.0", + "cross-env": "^7.0.3", "customize-cra": "^1.0.0", "customize-cra-less-loader": "^2.0.0", "eslint": "^8.9.0", diff --git a/yarn.lock b/yarn.lock index f501c0a..f7aa364 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5079,7 +5079,14 @@ cosmiconfig@^7.0.0: path-type "^4.0.0" yaml "^1.10.0" -cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3: +cross-env@^7.0.3: + version "7.0.3" + resolved "https://registry.npmmirror.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf" + integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw== + dependencies: + cross-spawn "^7.0.1" + +cross-spawn@^7.0.0, cross-spawn@^7.0.1, cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.npmmirror.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==