✅entry pointとなるコードブロック中で使われている相対URLによるimportを解決できない (@takker/ScrapJupyter)
現象
以下のcode blockを実行しようとするとエラーが出る
code:ts
import {say} from "./sample.ts";
say();
code:sample.ts
export const say = () => alert("Hello.");
code:error
Error: Build failed with 3 errors:
error: Cannot read directory ".": not implemented on js
error: Cannot read directory "https:/scrpabox.io/api/code/takker/entry_pointとなるコードブロック中で使われている相対urlによるimportを解決できない_(@takker%2Fscrapjupyter)": not implemented on js
<stdin>:1:23: error: Could not resolve "./sample.ts"
絶対URLで指定すればエラーにならない
code:ts
say();
原因
https://scrapbox.io/api/code/:project/:titleをcurrent directoryとして設定している(v.1.1.0)が、それが間違いのようだ おそらくPluginで使っているpath (e.g. deno-cache://...)が正しい
2021-12-31 10:55:05 ↑自分で書いてて、一体何をいっているのか全くわからないのだが……
解決策
resolveDirをPluginの仕様に沿ったpathに変える
Plugin自体を既存のものではなく、このUserScript専用のものに変えるという手段もある
それは後々考える
他のTODOとも関わることだし
2021-12-31
05:24:58 codingした
試してみる
06:02:17 merged