wallabyjs / console-ninja

Repository for Console Ninja questions and issues
https://console-ninja.com
Other
379 stars 19 forks source link

[Bug]: Does not work with Electron Forge Vite template #273

Closed sethyuan closed 8 months ago

sethyuan commented 8 months ago

What happened?

I have a project setup with Electron Forge (the vite-typescript template), the console.log calls I add to the project are not caught by Console Ninja.

Version

v1.0.288

Steps to reproduce (or sample repo)

Create a project with Electron Forge's vite-typescript template, add a console.log in source code, yarn start to run local dev.

Log output

09:56:37.325 info extension stopping host
09:56:37.490 info extension host process output: port:[54332]
09:56:37.486 info host ------------ starting ------------
09:56:37.490 info extension 
09:56:37.495 info host client connected: extension { address: '::', family: 'IPv6', port: 54332 }
09:56:37.503 info host starting host: {"extensionFolder":"/Users/sethyuan/.vscode/extensions/wallabyjs.console-ninja-1.0.288","runtimeHookFile":"/Users/sethyuan/.vscode/extensions/wallabyjs.console-ninja-1.0.288/out/runtimeHook/tracer.js","globalErrorHandlerFile":"/Users/sethyuan/.vscode/extensions/wallabyjs.console-ninja-1.0.288/out/runtimeHook/errorHandler.js","filesToInstrument":[{"path":"/users/sethyuan/dev/orca/src/comps/main/index.tsx","reason":"search"},{"path":"/users/sethyuan/dev/orca/src/libs/utils.ts","reason":"search"},{"path":"/users/sethyuan/dev/orca/src/main.ts","reason":"search"},{"path":"/users/sethyuan/dev/orca/src/libs/workers.ts","reason":"search"},{"path":"/users/sethyuan/dev/orca/src/hooks/use-shortcuts.ts","reason":"search"},{"path":"/users/sethyuan/dev/orca/src/libs/db/repo.ts","reason":"search"},{"path":"/users/sethyuan/dev/orca/src/libs/db/app.ts","reason":"search"}],"debug":false,"config":{"dateTimeFormat":"HH:mm:ss.SSS","dateTimeDisplayMode":"Absolute","installBinToPath":true,"openLinksInEditor":true,"maxLogViewerEntries":15000,"fontSize":10,"outputMode":"Beside File","captureFunctions":false,"searchUrl":"https://www.google.com/search?q={query}","enableProFeatures":true,"toolsToAutoPatch":["vite","angular","jest","webpack","next.js","nest.js","cypress","http-server","serve","live-server","nuxt","remix","qwik","hydrogen","serverless","astro"],"showErrors":true,"showLogsOnlyFromOpenedFiles":false,"showLogsFromLogPointsOnly":false,"showLogsFromMultipleRunningToolsTogether":false,"predictiveLoggingEnabled":true,"allowConsoleLogToTriggerPredictions":false},"allowedHosts":["localhost","127.0.0.1","example.cypress.io","SM3M.local","10.36.71.69"],"host":"127.0.0.1"}
09:56:37.510 info host starting tools discovery and integration
09:56:37.510 info host creating /Users/sethyuan/.console-ninja/.bin
09:56:37.511 info host installing /Users/sethyuan/.console-ninja/.bin/loader.js
09:56:37.511 info host installing /Users/sethyuan/.console-ninja/.bin/console-ninja
09:56:37.512 info host looking for tools to patch
09:56:37.563 info host worker Starting Host Worker...
09:56:37.599 info host found 1 tool file(s) to patch
09:56:37.600 info host patching /users/sethyuan/dev/orca/node_modules/vite/bin/vite.js
09:56:37.656 info host completed tools discovery and integration
10:04:27.568 info extension stopping host
10:04:27.569 info host removing cache folder: ab6ef04242f5cd51b0513afdec998042
10:04:31.865 info extension stopping host
10:04:32.039 info extension host process output: port:[54332]
10:04:32.035 info host ------------ starting ------------
10:04:32.039 info extension 
10:04:32.043 info host client connected: extension { address: '::', family: 'IPv6', port: 54332 }
10:04:32.050 info host starting host: {"extensionFolder":"/Users/sethyuan/.vscode/extensions/wallabyjs.console-ninja-1.0.288","runtimeHookFile":"/Users/sethyuan/.vscode/extensions/wallabyjs.console-ninja-1.0.288/out/runtimeHook/tracer.js","globalErrorHandlerFile":"/Users/sethyuan/.vscode/extensions/wallabyjs.console-ninja-1.0.288/out/runtimeHook/errorHandler.js","filesToInstrument":[{"path":"/users/sethyuan/dev/orca/src/main.ts","reason":"search"},{"path":"/users/sethyuan/dev/orca/src/comps/main/index.tsx","reason":"search"},{"path":"/users/sethyuan/dev/orca/src/libs/utils.ts","reason":"search"},{"path":"/users/sethyuan/dev/orca/src/libs/db/repo.ts","reason":"search"},{"path":"/users/sethyuan/dev/orca/src/libs/db/app.ts","reason":"search"},{"path":"/users/sethyuan/dev/orca/src/libs/workers.ts","reason":"search"},{"path":"/users/sethyuan/dev/orca/src/hooks/use-shortcuts.ts","reason":"search"},{"path":"/Users/sethyuan/dev/orca/src/comps/Main/index.tsx","reason":"open"}],"debug":false,"config":{"dateTimeFormat":"HH:mm:ss.SSS","dateTimeDisplayMode":"Absolute","installBinToPath":true,"openLinksInEditor":true,"maxLogViewerEntries":15000,"fontSize":10,"outputMode":"Beside File","captureFunctions":false,"searchUrl":"https://www.google.com/search?q={query}","enableProFeatures":false,"toolsToAutoPatch":["vite","angular","jest","webpack","next.js","nest.js","cypress","http-server","serve","live-server","nuxt","remix","qwik","hydrogen","serverless","astro"],"showErrors":true,"showLogsOnlyFromOpenedFiles":false,"showLogsFromLogPointsOnly":false,"showLogsFromMultipleRunningToolsTogether":false,"predictiveLoggingEnabled":true,"allowConsoleLogToTriggerPredictions":false},"allowedHosts":["localhost","127.0.0.1","example.cypress.io","SM3M.local","10.36.71.69"],"host":"127.0.0.1"}
10:04:32.055 info host starting tools discovery and integration
10:04:32.057 info host looking for tools to patch
10:04:32.114 info host worker Starting Host Worker...
10:04:32.134 info host found 1 tool file(s) to patch
10:04:32.134 info host patching /users/sethyuan/dev/orca/node_modules/vite/bin/vite.js
10:04:32.134 info host completed tools discovery and integration
10:15:53.455 info buildHook-3241 file processed (stat): 0 log points, error handler: false
10:17:10.335 info host client disconnected: buildHook 1006
10:17:10.336 info host client disconnected: buildHook 1006, has clients false
10:17:14.798 info extension stopping host
10:17:14.800 info host removing cache folder: 2db145ea328cf27cac76d6f403ae092c
10:17:15.734 info extension stopping host
10:17:15.913 info extension host process output: port:[54332]
10:17:15.908 info host ------------ starting ------------
10:17:15.913 info extension 
10:17:15.916 info host client connected: extension { address: '::', family: 'IPv6', port: 54332 }
10:17:15.923 info host starting host: {"extensionFolder":"/Users/sethyuan/.vscode/extensions/wallabyjs.console-ninja-1.0.288","runtimeHookFile":"/Users/sethyuan/.vscode/extensions/wallabyjs.console-ninja-1.0.288/out/runtimeHook/tracer.js","globalErrorHandlerFile":"/Users/sethyuan/.vscode/extensions/wallabyjs.console-ninja-1.0.288/out/runtimeHook/errorHandler.js","filesToInstrument":[{"path":"/users/sethyuan/dev/orca/src/comps/main/index.tsx","reason":"search"},{"path":"/users/sethyuan/dev/orca/src/main.ts","reason":"search"},{"path":"/users/sethyuan/dev/orca/src/hooks/use-shortcuts.ts","reason":"search"},{"path":"/users/sethyuan/dev/orca/src/libs/utils.ts","reason":"search"},{"path":"/users/sethyuan/dev/orca/src/libs/db/repo.ts","reason":"search"},{"path":"/users/sethyuan/dev/orca/src/libs/db/app.ts","reason":"search"},{"path":"/users/sethyuan/dev/orca/src/libs/workers.ts","reason":"search"},{"path":"/Users/sethyuan/dev/orca/src/comps/Main/index.tsx","reason":"open"}],"debug":false,"config":{"dateTimeFormat":"HH:mm:ss.SSS","dateTimeDisplayMode":"Absolute","installBinToPath":true,"openLinksInEditor":true,"maxLogViewerEntries":15000,"fontSize":12,"outputMode":"Beside File","captureFunctions":false,"searchUrl":"https://www.google.com/search?q={query}","enableProFeatures":false,"toolsToAutoPatch":["vite","angular","jest","webpack","next.js","nest.js","cypress","http-server","serve","live-server","nuxt","remix","qwik","hydrogen","serverless","astro"],"showErrors":true,"showLogsOnlyFromOpenedFiles":false,"showLogsFromLogPointsOnly":false,"showLogsFromMultipleRunningToolsTogether":false,"predictiveLoggingEnabled":true,"allowConsoleLogToTriggerPredictions":false},"allowedHosts":["localhost","127.0.0.1","example.cypress.io","SM3M.local","10.36.71.69"],"host":"127.0.0.1"}
10:17:15.928 info host starting tools discovery and integration
10:17:15.930 info host looking for tools to patch
10:17:15.989 info host worker Starting Host Worker...
10:17:16.007 info host found 1 tool file(s) to patch
10:17:16.007 info host patching /users/sethyuan/dev/orca/node_modules/vite/bin/vite.js
10:17:16.007 info host completed tools discovery and integration
NikGovorov commented 8 months ago

Currently we don't support Electron Forge out of the box, because it doesn't use vite directly. To get Console Ninja working with vite-template, you need to prefix yarn start with console-ninja -> console-ninja yarn start. Please visit Universal Apps support docs for more information.

sethyuan commented 8 months ago

Thanks for the tip! However, this only send console logs to the main process (node process), it does not collect console logs from the BrowserWindows. Any other tips?

NikGovorov commented 8 months ago

I've created a simple project with npm init electron-app@latest electron-app -- --template=vite-typescript and running console-ninja npm start works for me:

image

How do you create your project? What do you see in Dev Tools?

NikGovorov commented 8 months ago

If you've got CSP enabled, you'll need to disable it.

sethyuan commented 8 months ago

If you've got CSP enabled, you'll need to disable it.

This is the issue, thank you very much!