- From: Paweł Psztyć <notifications@github.com>
- Date: Fri, 06 Dec 2019 15:03:00 -0800
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/webcomponents/issues/716/562773022@github.com>
I'd like to join the discussion with additional use case for scoping but in a different context. I am not sure if that is actually related to this but please, let me know if that would require a new feature request. I have a problem with very complex SPA applications and custom elements. In my organization we (so far) have a one application that is completely build with WC and the rest is React. In the platform we have several different applications developed by different teams. The applications work under single SPA. The shell app just requires new sources to be downloaded when switching between apps. There is no actual page reload. This one WC based application is used in multiple other applications (4 so far). If we would like to incorporate the components into the build process of each application this would inevitably lead to name collision and component registration errors when another application sources are requested. Because of that currently we are bundling this single WC based application into own package and it is included by a script from our CDN. Because all apps uses the same script (from the same URL) the import occurs only once. So far it works fine. But then if we would like to introduce a new application that re-use some of the components used in the first application that would lead to name collision again. We would have to come up with a very clever build system that can work across multiple applications and scripts that imports WC bundles depending on current context without causing names collisions. I am not sure if we would be able to do this to be honest. Alternative would be not to bundle WC at all and host separate components on CDN. However, even after minification, this would take ages to download the application (the WC based app I mentioned before has over 120 components in the dependencies tree). More applications like that just add to that. What I was thinking is a way to somehow scope web components bundle so there are no registry collisions. However doing this on the component level would defeat the purpose because the scope is defined at the moment of bundling specific application. Do you guys have similar use case already? Do you think we could make it easier for complex systems to work with WC? -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/w3c/webcomponents/issues/716#issuecomment-562773022
Received on Friday, 6 December 2019 23:03:02 UTC