fix(phone/watch): Fixed in-game watch and prevent debug inject

If using the `watch` script in game, the debug injections will not occur.
This commit is contained in:
Taso committed 2021-04-13 22:04:23 -04:00
1 parent 8dc59c47bd
commit 71bb73b54e
3 files changed
+9 -10

No files matched your search

+5 -5
View File
@@ -1,4 +1,4 @@
const path = require('path') const path = require('path');
const { const {
addAfterLoader, addAfterLoader,
@@ -54,13 +54,13 @@ module.exports = {
if (!babelLoaderIsAdded) throwError('failed to add back babel-loader for non-application JS'); if (!babelLoaderIsAdded) throwError('failed to add back babel-loader for non-application JS');
paths.appBuild = webpackConfig.output.path = path.resolve('../resources/html') paths.appBuild = webpackConfig.output.path = path.resolve('../resources/html');
return webpackConfig; return webpackConfig;
}, },
}, },
devServer: (devServerConfig) => { devServer: (devServerConfig) => {
devServerConfig.writeToDisk = true devServerConfig.writeToDisk = true;
return devServerConfig return devServerConfig;
} },
}; };
+3 -4
View File
@@ -53,11 +53,10 @@
"scripts": { "scripts": {
"i18n:missing": "node --experimental-json-modules i18n.missingKeys.js", "i18n:missing": "node --experimental-json-modules i18n.missingKeys.js",
"copy:config": "cp-cli ../config.json ./src/config.autogen.json", "copy:config": "cp-cli ../config.json ./src/config.autogen.json",
"start": "craco start", "start": "cross-env PUBLIC_URL=/ craco start",
"watch": "craco watch", "watch": "cross-env REACT_APP_IN_GAME=1 craco start",
"build": "yarn copy:config && craco build", "build": "yarn copy:config && craco build",
"test": "craco test --watchAll=false --testMatch **/src/**/*.test.{ts,js,tsx}", "test": "craco test --watchAll=false --testMatch **/src/**/*.test.{ts,js,tsx}"
"build:craco": "craco build"
}, },
"eslintConfig": { "eslintConfig": {
"extends": "react-app" "extends": "react-app"
+1 -1
View File
@@ -28,7 +28,7 @@ interface DebugEvent<P = any> {
* ]) * ])
**/ **/
const InjectDebugData = <P>(events: DebugEvent<P>[], timer = 1000) => { const InjectDebugData = <P>(events: DebugEvent<P>[], timer = 1000) => {
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development' && !process.env.REACT_APP_IN_GAME) {
for (const event of events) { for (const event of events) {
setTimeout(() => { setTimeout(() => {
window.dispatchEvent( window.dispatchEvent(