Skip to content
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

Support for chunked ESM plugins #2199

Open
mattrunyon opened this issue Aug 26, 2024 · 0 comments
Open

Support for chunked ESM plugins #2199

mattrunyon opened this issue Aug 26, 2024 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@mattrunyon
Copy link
Collaborator

It would be great if we could support ESM plugins with multiple files. Right now our restrictions are CJS and a single file. This results in some potentially large plugin files without the ability to lazy load.

For example, we could lazy load the majority of the plotly-express plugin. Right now it will all be fetched at initial page load, but we could load just the object that says what types it supports and lazy import the component when it's needed.

I don't think the remote-component-loader library we use can handle ESM. We could probably support this natively with import maps (MDN page). The difficulty with import maps would be ensuring everything still works with Vite (I think dev mode would be the trickiest) like the React contexts

I've done some basic testing and our DHC config at least sends back any extra files I put in the plugins directory, so an await import('/js-plugins/my-plugin.js') which imports other files around it should work just fine as far as the server is concerned.

@mattrunyon mattrunyon added enhancement New feature or request triage Issue requires triage labels Aug 26, 2024
@deephaven deephaven deleted a comment Aug 26, 2024
@vbabich vbabich added this to the Backlog milestone Aug 27, 2024
@vbabich vbabich removed the triage Issue requires triage label Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants