refactor: use javascript module name ending

This commit is contained in:
Jeremy Wall 2024-04-04 16:22:49 -04:00
parent 03820d2941
commit c12c7c2477
2 changed files with 3 additions and 3 deletions

View File

@ -262,7 +262,7 @@ pub fn mk_ui_routes(config: Arc<Vec<Dashboard>>) -> Router<Config> {
fn graph_lib_prelude() -> Markup { fn graph_lib_prelude() -> Markup {
html! { html! {
script src="/js/plotly.js" { } script src="/js/plotly.js" { }
script type="module" defer src="/js/lib.js" { } script type="module" defer src="/js/lib.mjs" { }
link rel="stylesheet" href="/static/site.css" { } link rel="stylesheet" href="/static/site.css" { }
} }
} }
@ -370,13 +370,13 @@ pub async fn plotly() -> Response<String> {
} }
pub async fn lib() -> Response<String> { pub async fn lib() -> Response<String> {
javascript_response(include_str!("../static/lib.js")) javascript_response(include_str!("../static/lib.mjs"))
} }
pub fn mk_js_routes(config: Arc<Vec<Dashboard>>) -> Router<Config> { pub fn mk_js_routes(config: Arc<Vec<Dashboard>>) -> Router<Config> {
Router::new() Router::new()
.route("/plotly.js", get(plotly)) .route("/plotly.js", get(plotly))
.route("/lib.js", get(lib)) .route("/lib.mjs", get(lib))
.route("/htmx.js", get(htmx)) .route("/htmx.js", get(htmx))
.with_state(State(config)) .with_state(State(config))
} }