-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Force developers to use async imports on key rendering APIs #75079
Comments
Pinging @elastic/kibana-platform (Team:Platform) |
Pinging @elastic/kibana-operations (Team:Operations) |
I think we probably need to rely on eslint here. I don't think we'll be able to use magic comments to accomplish this. It seems like it would be a lot easier to validate that render functions use |
@restrry to investigate how many plugins are violating this now to determine impact & whether or not this is worth the effort right now |
Checking to see if there is something we see as actionable here or if we want to close it. At the end of the day, I think teams need to own their async logic and not require us to do anything magical. cc @pauldotpower @stacey-gammon |
I think we could close this. I think the time would be better spent focusing on page load time metrics, plus education regarding async imports, in order to give teams the motivation and knowledge to leverage them. We'll never be able to catch and prevent all of these sync imports that should actually be async. |
I'll go ahead and close, then. |
In order to keep Kibana's frontend lean, we may want to consider changing some of the APIs we have for rendering in order to force applications to use async imports in the spots where plugins most often import more code than they should.
For example, it'd be great to be able to support something like:
The challenge with this will be figuring out how to make this work with Webpack's async chunk feature. Currently, it will only create an async chunk if there is an
import('./application/render')
call and usingimport()
with dynamic values leads to Webpack trying to build bundles out of all the possible modules that could be referenced.I haven't investigated how we could make this work, but I suspect there may be a way using Webpack's "magic comments" and some
require.resolve
magic.If we do find a way to make this work, we should also apply it to APIs much as Embeddables so that we can be sure that embeddables can be registered without importing very much code into a plugin's primary bundle.
The text was updated successfully, but these errors were encountered: