-
Notifications
You must be signed in to change notification settings - Fork 23
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
[Bug]: console-ninja does not work in our RushJS based monorepo #351
Comments
Thanks for letting us know about your issue. Console Ninja uses a 3rd party npm package to scan your files at startup as part of detecting which development tools you are using. We can see in your small sample repo that the directories are being scanned 17 times more than expected. We understand the cause of this behavior and if you have more shared dependencies between your packages, this may be exacerbated. We also think it's possible with a recursive symlink to stop Console Ninja from starting; this may be what's happening in your case. We're working on a fix and should have an update for you in the next day or so. |
Thanks Simon! Makes sense, there are a huge amount of shared symlinked dependencies between packages in our monorepo. |
This is unrelated, but I'm curious what I'm missing out on because console-ninja can't update my |
If Console Ninja wasn't able to update your
We have made updated Console Ninja's dependency scanning logic and believe it should fix your issue. Can you please update to Console Ninja |
Verified it's picking up some tools and working in our storybooks now, I'll confirm it works with our main webpack app tomorrow but it's looking good (I can see it's patching webpack for it, but under the packages node_modules not common/temp/node_modules like it is for the storybooks but hopefully that's correct). Thanks for the fast fix! |
Ok I've had a chance to test the webpack app. I can see Console Ninja has patched it because it logs the console ninja message when I start webpack, but it doesn't seem to be connected in the browser. I don't see a message logged in the browser console saying console ninja is running (which I think I remember from the Storybook test that did work?). At this point I think it's not a RushJS issue, but an issue with how our webpack environment is setup. The main thing I can think of that might be tripping it up is that we use a browser extension to redirect requests to the JS asset files on different domains to the local webpack server. ie you start webpack, and instead of opening the webpack host URL you open our website and the requests for JS assets are redirected to the webpack server running on a different host. Could the fact that console ninja is "listening" on a different host be the problem? Any other into/details I can share? |
Accessing your local development environment via an external host may definitely be causing a problem. In your browser, by default, Console Ninja will simply do nothing if the app host is not 127.0.0.1, localhost, or one of your network adapter's IP v4 addresses. To connect from a different host name, use the Unfortunately your sample repo didn't work for us, but we were able to see the symlink problem. Can you please confirm that you saw |
Yes I was able to see logs coming through into console-ninja from the sample repo. I did not have the hosts configured so I figured that must be it, but I've added our domain into the settings and I'm still not getting anything. Nothing in the console, no attempt to connect in the network tab of the devtools. Is there anything else I can poke at to try and debug? |
Sorry for the slow reply. Can you please provide your updated |
Yep sorry should have attached it before 🙈
|
@UberMouse Thanks for providing the details. Can you please also share the URL that you are trying open after your webpack dev server starts? It looks like it's possibly not being accepted by the currently configured |
After you open the browser (with Ninja started and webpack server running), can you please
|
Yea doesn't look like console-ninja is instrumenting the build. Looking at a console.log statement there is nothing surrounding it like you mention and Can see that both variants of webpack that pnpm is managing have been patched with the console-ninja hook (by inspecting lib/WebpackOptionsApply.js and seeing the console-ninja hook is in place) and the Will console-ninja track log statements in packages in node_modules? The log statements will be coming from there for the most part. However probably not the cause of this problem considering |
Initially (after start) Console Ninja will not instrument There's some Can you please
|
Added a console.log to the first line of the entrypoint, no instrumentation and still undefined for
Not possible with the current setup but I'll try and hack together something to let me do this tomorrow and get back to you |
What happened?
Attempted to use console ninja in our RushJS based monorepo, no tools are detected. So I setup a minimal RushJS repo with a single webpack based package and that worked successfully using the same style of setup, so console-ninja does work in RushJS based repos, rigs, and the heft build tool.
Our RushJS monorepo is somewhat sizeable, 70ish packages, half a million SLOC, I open it in VSCode at the root and let console-ninja start with default settings. Our node_modules folder (RushJS has a single node_modules setup that contains all dependencies, each package gets the dependencies it depends on symlinked into it's node_modules folder, unclear if this is entirely normal pnpm behaviour or if Rush is building ontop of that) is about 2 gigabytes with nearly 200,000 files in it and this is the directory that console-ninja instruments in my working example (which you can see logs of here) so I wonder if it's timing out or something? I let it sit there "looking for tools to patch" for 5+ minutes until it eventually logged about removing the cache folder
Anyway, not sure what else to provide as the logs don't seem to really hint at the problem, it just hangs finding tools to patch.
Here is my test repo for reference https://github.com/UberMouse/console-ninja-rush-test
Version
1.0.366
CLI command to start your dev tool
heft package-watch --serve
Steps to reproduce (or sample repo)
Can't provide steps or a sample as the issue is only reproducible in our private codebase
Log output
The text was updated successfully, but these errors were encountered: