[Feature Request] Support Javascript importmap
Hi! Thank you for developing this great library.
Is your feature request related to a problem? Please describe.
With modern javascript, it is common practice to use importmaps in the head of the document. This is not currently supported when creating dash app and external_scripts is the only relevant option.
<script type="importmap">
{
"imports": { 'libname': url}
}
</script>
Describe the solution you'd like Add an option to Dash application to add an importmap to page head.
Describe alternatives you've considered
I am currently using regular expressions to edit app.index_string, but this can be brittle and may no longer work with newer dash versions.
Additional context I have tried the forums search, but there seem to be some issues searching for a specific string like "importmap". I am not 100% confident this has not been addressed there.
Hi @shumash
Yes, that would be a nice feature!
In the meantime, you might find the new hooks feature better for modifying the app.index_string
More in the docs here: https://dash.plotly.com/dash-plugins-using-hooks#updating-an-app's-html-with-hooks.index
Thanks! That does look useful as well.
@shumash we won't be picking this up ourselves, but if you'd like to contribute a PR adding native support, we'd be happy to review.
@shumash we won't be picking this up ourselves, but if you'd like to contribute a PR adding native support, we'd be happy to review.
I will pick this up, we also need type="module" support since that will allow more bundling strategy to work with async chunks and allows us to support modern building tools (vite/esbuild).