Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic replay analyzer #646

Closed

Conversation

coin-au-carre
Copy link
Contributor

@coin-au-carre coin-au-carre commented Mar 16, 2021

Work is in progress but functionnal. I put everything in one component dialog for the moment, because I am sure there will be quite some modifications and I am not comfortable with React.

CI should crash because I have introduced those errors

webpack building...
webpack built server e36b09157229eefea611 in 1076ms
assets by status 558 KiB [cached] 3 assets
assets by status 11.6 MiB [emitted]
  asset client.js 11.6 MiB [emitted] (name: client)
  asset client.4d054200acade8b7a049.hot-update.js 21.2 KiB [emitted] [immutable] [hmr] (name: client)
  asset client.4d054200acade8b7a049.hot-update.json 30 bytes [emitted] [immutable] [hmr]
Entrypoint client 11.6 MiB = client.js 11.6 MiB client.4d054200acade8b7a049.hot-update.js 21.2 KiB
cached modules 4.42 MiB [cached] 771 modules
runtime modules 29.4 KiB 18 modules
./client/replays/replay-dialog.jsx 7.81 KiB [built] [code generated]

ERROR in ./client/replays/action-creators.js 10:0-20
Module not found: Error: Can't resolve 'fs' in 'E:\Prog\ShieldBattery\client\replays'
 @ ./client/replays/replay-dialog.jsx 20:0-48 60:26-37
 @ ./client/dialogs/connected-dialog-overlay.jsx 20:0-52 164:21-33
 @ ./client/main-layout.jsx 29:0-72 428:376-398
 @ ./client/app.jsx 24:0-39 79:19-29
 @ ./client/index.jsx 21:0-24 153:150-153

ERROR in ./client/replays/replay-dialog.jsx 12:0-20
Module not found: Error: Can't resolve 'fs' in 'E:\Prog\ShieldBattery\client\replays'
 @ ./client/dialogs/connected-dialog-overlay.jsx 20:0-52 164:21-33
 @ ./client/main-layout.jsx 29:0-72 428:376-398
 @ ./client/app.jsx 24:0-39 79:19-29
 @ ./client/index.jsx 21:0-24 153:150-153

ERROR in ./node_modules/jssuh/index.js 8:13-28
Module not found: Error: Can't resolve 'zlib' in 'E:\Prog\ShieldBattery\node_modules\jssuh'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "zlib": require.resolve("browserify-zlib") }'
        - install 'browserify-zlib'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "zlib": false }
 @ ./client/replays/action-creators.js 13:0-33 25:23-35
 @ ./client/replays/replay-dialog.jsx 20:0-48 60:26-37
 @ ./client/dialogs/connected-dialog-overlay.jsx 20:0-52 164:21-33
 @ ./client/main-layout.jsx 29:0-72 428:376-398
 @ ./client/app.jsx 24:0-39 79:19-29
 @ ./client/index.jsx 21:0-24 153:150-153

3 errors have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

No idea where it comes from, it also targets a file I have not touched. There might be this solution but I am not confident that this fix is good for us.

edit: Hum CI did not crash ?

@tec27
Copy link
Member

tec27 commented Mar 17, 2021

The CI doesn't run the webpack build on Electron stuff so it wouldn't error in that way. The problem is caused by using node builtins in Electron renderer (e.g. browser) code.

We have a few places that still do that, but in general you should avoid it and instead use IPC for things that need to e.g. read files. Our IPC setup is sort of haphazard but an example to look at would be the ActiveGameManager stuff:

https://github.com/ShieldBattery/ShieldBattery/blob/master/app/app.ts#L262
https://github.com/ShieldBattery/ShieldBattery/blob/master/client/active-game/active-game-manager-ipc.ts

@coin-au-carre
Copy link
Contributor Author

Ok it makes sense thanks.
Still I do not understand why the error ERROR in ./client/replays/action-creators.js 10:0-20 arises only now (it should have been before). I have not made any modification in this particular file and I cannot see why my changes could be responsible for it.

@tec27
Copy link
Member

tec27 commented Mar 17, 2021

If I had to guess, it's probably that those action creators were previously included only in files that were safeguarded to be electron-only, whereas connected-dialog is available in both the browser version and the electron version. Not entirely certain though =/

@2Pacalypse-
Copy link
Member

Closed in favour of #845

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants