quarto-dev / quarto-dev/quarto

Shiny server does not allow local OJS/js module imports

オープン
#653 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
TypeScript
スター
645
フォーク
62
平均マージ
17時間 42分
マージ済み PR(30日)
13

説明

Problem:
When trying to import a local module for OJS as outlined here when server: shiny, an error occurs and the module cannot be used. The module is found, otherwise the error will occur on initial build and the render will fail, but it is unable to be imported. This does not happen if the shiny server is not used. It would be useful to be able to store OJS code (such as functions that can make plots) as a .qmd module and import it into a quarto document running with a shiny server to feed in the data.

Currently this is the error that occurs:
Error: error loading dynamically imported module Loading module from “http://localhost:6366/square.js” was blocked because of a disallowed MIME type (“text/html”)

Minimal Example:

square.js:
export function square(x) { return x * x; }

This works:

---
title: "Module Import Test"
format: html
---

```{ojs}
//| echo: true
//| output: true

import { square } from "./square.js";
square(5);
```

This does not:

---
title: "Module Import Test"
format: html
server: shiny

---

```{ojs}
//| echo: true
//| output: true

import { square } from "./square.js" // This recieves an error and square is undefined. 
square(x) 
```

```{ojs}
x * x  // This code is able to run perfectly fine
```

```{r}
#| context: server
#| echo: true
x <- reactive(5)

ojs_define(x)
```

Environment Information
Quarto Version: 1.7.6
Browser: Firefox & Chrome
Shiny Version: 1.10.0
R Version: 4.4.2

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Reproduce the failure with square.js and the minimal Quarto document using server: shiny, comparing it with the working non-Shiny document. Start by tracing how the local JavaScript module is served during Shiny rendering; done means the local OJS import loads and square(5) works in the Shiny document without the MIME-type error.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, r
領域
backend, web-dev
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。