-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Bug: Cannot resolve symbol s_c7PiYJ1s0GU... Error code (31) - Namespace conflicts #519
Comments
Misko says this is an optimizer issue: QwikDev/qwik#5097 This still happens in Qwik version 1.2.18 btw. |
Spent the entire day trying to find a solution but I believe this is only solvable by changing the optimizer. For the moment we have a few options:
|
Awesome find @maiieul! Out of all of these 4 definitely seems like the ideal workaround. The user would have to add a submodule for each component, which can be tedious, but I think that is a better alternative to the confusing namespace errors. With that said though, if the optimizer issue is fixed, do we need preserveModules? Like you mentioned, that seems to be the option giving this tradeoff in the first place. @shairez would love to hear your thoughts, especially with the PR #511. My understanding, is that we were trying to fix this in all libs, or change the library starter so that it properly tree shakes. |
@thejackshelton Yes, after a good night's sleep, I realized that we also have another option, which is to not use preserveModules until the issue gets fixed in the optimizer. I would suggest doing that for now, and if the issue hasn't been fixed by the time we reach v1, then we can think this through again and see if it's worth using any of the workaround above with Perhaps in the meantime we can improve tree-shaking on the big bundle. Maybe marking some functions as QRLs with the $ sign, and make sure that huge JSON files don't get bundled in it. Maybe that's why you put |
@maiieul my work on fixing the bundle size issue was delayed because after upgrading to the latest version we discovered that the Cypress tests do not run, now that @dmitry-stepanenko is going to look at the cypress issue, I have more time to integrate it into main so we could release a version. Have you checked my work on #511 ? I think we should pair up and see if it's still doesn't solve the issue, because what I worked on might solve it as currently in main it doesn't reflect all of the solutions that my PR added |
Core issue: QwikDev/qwik#5473 |
Closing since QwikDev/qwik#5473 has been resolved. |
Error message:
@shairez @thejackshelton @wmertens So I've been able to narrow down the "cannot resolve symbol s_c7PiYJ1s0GU..." issue I got on qwikcn by consuming qwik-ui (the one I was showcasing on wednesday).
The problem is that
build.rollupOptions.output.preserveModules
creates namespace issues.So with
If I now create a component and call it with the same name as one of the headless-kit's components:
This newly defined AccordionRoot will override the one exported by the headless-kit.
I found this bug happening when there is a useVisibleTask$ inside of the headless-kit's component, I guess because useVisibleTask$ will create a separate symbol that tries to access the headless-kit's component, but it isn't there anymore as it got overwritten by my component. Maybe the bug can happen in other circumstances as well.
My understanding is that we need this
preserveModules
config in the headless library to avoid the big bundle issue. Looks like this is because withoutpreserveModules
Qwik doesn't know how to bundle the already bundled headless components.My workaround for now would be to rename the headless components to something like
HeadlessAccordionRoot
and so on..Would be better DX though if we can keep the normal naming, no? I'll try to see if I can come up with a better workaround tomorrow 🙃
repro: https://github.com/maiieul/qwik-ui-tabs-repro
You need to run the production build to see the error (
pnpm preview
)Simply change the name of the
AccordionRoot
component toMyAccordion
or any other name not already being used by the headless-kit and the error is gone.The text was updated successfully, but these errors were encountered: