File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
30
30
## Changed
31
31
- [#2652](https://github.com/plotly/dash/pull/2652) dcc.Clipboard supports htm_content and triggers a copy to clipboard when n_clicks are changed
32
32
- [#2721](https://github.com/plotly/dash/pull/2721) Remove ansi2html, fixes [#2613](https://github.com/plotly/dash/issues/2713)
33
+ - [#2730](https://github.com/plotly/dash/pull/2721) Load script files with `.mjs` ending as js modules
33
34
34
35
## [2.14.2] - 2023-11-27
35
36
Original file line number Diff line number Diff line change @@ -855,9 +855,20 @@ def _relative_url_path(relative_package_path="", namespace=""):
855
855
raise Exception ("Serving files from absolute_path isn't supported yet" )
856
856
elif "asset_path" in resource :
857
857
static_url = self .get_asset_url (resource ["asset_path" ])
858
- # Add a cache-busting query param
859
- static_url += f"?m={ resource ['ts' ]} "
860
- srcs .append (static_url )
858
+ # Import .mjs files with type=module script tag
859
+ if static_url .endswith (".mjs" ):
860
+ srcs .append (
861
+ {
862
+ "src" : static_url
863
+ + f"?m={ resource ['ts' ]} " , # Add a cache-busting query param
864
+ "type" : "module" ,
865
+ }
866
+ )
867
+ else :
868
+ srcs .append (
869
+ static_url + f"?m={ resource ['ts' ]} "
870
+ ) # Add a cache-busting query param
871
+
861
872
return srcs
862
873
863
874
def _generate_css_dist_html (self ):
You can’t perform that action at this time.
0 commit comments