-
Notifications
You must be signed in to change notification settings - Fork 513
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
Fix broken Hot Reload of Plexus Package #2089
Fix broken Hot Reload of Plexus Package #2089
Conversation
Signed-off-by: Wise-Wizard <[email protected]>
Signed-off-by: Wise-Wizard <[email protected]>
…d/jaeger-ui into Plexus_Bug/Hot_Reload
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
was this something you meant to commit? I don't see any new test files. |
No, I apologize I was trying to keep the format same from my previous PR message and ended up including the Unit Test line as well. I have removed it now from the message! |
No problem at all :) |
What to do about the date time unit test, it is totally unrelated from the changes I made and I guess it was persistent in previous PRs as well? |
Hi @yurishkuro , once this PR is merged, may I resume working on resolving the issue with the Graph Zoom Buttons |
I fixed the failing test #2091. |
packages/plexus/package.json
Outdated
@@ -3,7 +3,7 @@ | |||
"license": "Apache-2.0", | |||
"version": "0.2.0", | |||
"description": "Directed Graph React component", | |||
"main": "lib/index.js", | |||
"main": "src/index.tsx", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hold on, I don't think this is the right fix. When I talked about overrides I was referring to jaeger-ui package, similar to the other import fixes you did. But if you make this change in plexus then it breaks it as a standalone library, because once it's published (e.g. to npm) only the /lib folder is included in the bundle, not the sources (as far as I understand). Even if sources are included, it would not be usable from pure JS projects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example, Bard things there are multiple ways to do that: https://g.co/bard/share/12a255963a6f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are right the src won't be included, even if it is included it won't be compatible because it is written in TypeScript. But, this was the only possible override which pointed all the imports to src and not lib. Changing it back to lib, I will have to individually modify all the import statements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, don't change imports, try to look into override options
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it will look into this
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2089 +/- ##
=======================================
Coverage 96.57% 96.57%
=======================================
Files 254 254
Lines 7620 7620
Branches 1986 1986
=======================================
Hits 7359 7359
Misses 261 261 ☔ View full report in Codecov by Sentry. |
@@ -12,7 +12,7 @@ | |||
// See the License for the specific language governing permissions and | |||
// limitations under the License. | |||
|
|||
import { TVertex } from '@jaegertracing/plexus/lib/types'; | |||
import { TVertex } from '@jaegertracing/plexus/src/types'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am actually somewhat skeptical about this - all the imports you fixed are referring to types. Types don't contain any functionality, so while useful when the types themselves are changing, they won't fix the actual hot reloading issue.
Also, see my other comment https://github.com/jaegertracing/jaeger-ui/pull/2089/files#r1443119010. I think if you find a way to instruct jaeger-ui package at a global level to prefer src instead of lib of Plexus, you may not need to change these imports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but even if it is changed at global level. The individual import will specifically still point to the lib instead of src right? Correct me if I am wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you have to look into those suggestions from Bard - my understanding is if you override at a global level then the build system will dynamically replace the imports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @yurishkuro have been working on this since yesterday night. Tried various methods, and on modifying the tsconfig.json file, to point @jaegertracing/plexus to src package all the imports now automatically point to plexus/src now.
But, the problem that is not being resolved and I am stuck at is that Hot reload is still not working even after this.
Do you have any input that could be causing this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please describe which override methods you tried |
Tried using alias in vite.config.mts file, and mostly spent time tinkering with tsconfig file of both plexus and jaeger-ui until the right baseUrl and paths were set so that @jaegertracing/plexus would point to the right path |
please show changes that you tried. |
I just read up more on this, and the two approaches that sound like they should work are
|
There is only a single webpack file, webpack-factory.js and in it the entry points are in src itself. Should I look into custom import rewrite to vite? |
this is in |
That file is inside plexus. I am not suggesting to change plexus, but to change how jaeger-ui package imports it. |
Yes, but the import @jaegertracing/plexus were only present inside jaeger-ui. |
Yes, that's what I am trying to say there are no global webpack files only the one inside plexus. |
Update: I tried changing the global tsconfig file as well in the same way to override the import. That also managed to make the import point to plexus/src, but the hot reload feature is still not working. |
|
There are examples of monorepos with vite.js in this thread: |
Hi @yurishkuro , Update: Finally found out a way to configure it, updated dependencies in vite.config.mts using alias and now hot reload is working perfectly fine 😇 |
Signed-off-by: Wise-Wizard <[email protected]>
Signed-off-by: Wise-Wizard <[email protected]>
Signed-off-by: Wise-Wizard <[email protected]>
packages/jaeger-ui/tsconfig.json
Outdated
"baseUrl": "..", | ||
// other options... | ||
"paths": { | ||
"@jaegertracing/plexus": ["plexus/src"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed given the vite.config change? Doing override in tsconfig means it only affects typescript source files, but we have a mix of ts/js, so I was looking for a more global override.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is needed apparently it is required for the TypeScript compiler to need to know about our aliases so that it can compile all of our imported files accordingly. I think for js there are no such requirements, hence it will work for js files as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tsc-lint is failing
Error: [tsc-lint ] packages/plexus/src/DirectedGraph/builtins/PureEdges.tsx(17,22): error TS6059: File '/home/runner/work/jaeger-ui/jaeger-ui/packages/plexus/src/DirectedGraph/builtins/EdgePath.tsx' is not under 'rootDir' '/home/runner/work/jaeger-ui/jaeger-ui/packages/jaeger-ui'. 'rootDir' is expected to contain all source files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed given the vite.config change? Doing override in tsconfig means it only affects typescript source files, but we have a mix of ts/js, so I was looking for a more global override.
Just checked reverting the tsconfig to default, and hot reload is working fine. Had only made the changes because this website mentioned it https://dev.to/tilly/aliasing-in-vite-w-typescript-1lfo
Pushing the changes now.
Signed-off-by: Wise-Wizard <[email protected]>
Signed-off-by: Wise-Wizard <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Please add a comment and this is good to merge.
Co-authored-by: Yuri Shkuro <[email protected]> Signed-off-by: Saransh Shankar <[email protected]>
Thanks! |
No Problem! Thanks a lot for your patience and guidance! Can I resume working on the zoom buttons now? |
why do you feel you need to ask? |
No, just wanted to confirm if there was something else you would like me to look at before resuming the work on zoom button fix. 😅 |
this one #2093 |
Sure, will look into it next! |
See jaegertracing/jaeger#5084. No projects decided for the summer yet. |
Thanks! Looking forward to it. |
Addresses Hot Reload Dysfunctionality in Plexus Package: Unresponsive to src Package Changes in UI
Implemented comprehensive modifications to rectify the malfunctioning Hot Reload feature in the Plexus package. This issue resulted in an inability to reflect changes made to the src package in the user interface (UI). The following refinements have been executed to mitigate the problem:
Testing Process:
The remedial changes underwent a robust testing process to ensure a comprehensive resolution to the Hot Reload issue:
Checklist
To comply with the project's contribution guidelines, the following checklist items have been addressed:
jaeger
:make lint test
jaeger-ui
:yarn lint
andyarn test
Your constructive feedback is welcome and appreciated. Thank you for your time and consideration.