dash icon indicating copy to clipboard operation
dash copied to clipboard

[Feature Request] Support Javascript importmap

Open shumash opened this issue 1 month ago • 2 comments

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.

shumash avatar Dec 05 '25 00:12 shumash

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

AnnMarieW avatar Dec 05 '25 02:12 AnnMarieW

Thanks! That does look useful as well.

shumash avatar Dec 05 '25 18:12 shumash

@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.

ndrezn avatar Dec 10 '25 16:12 ndrezn

@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).

T4rk1n avatar Dec 12 '25 15:12 T4rk1n