yamamoto-yuta / yamamoto-yuta.github.io

https://yamamoto-yuta.github.io/
0 stars 0 forks source link

executeScript() で呼ぶ関数の中で別ファイルの関数を呼び出したい #21

Open yamamoto-yuta opened 1 year ago

yamamoto-yuta commented 1 year ago
# 必要に合わせてコメントアウトを外して記載してください

# 記事の説明文(無い場合は本文先頭200文字を使用)
#ogp_description:

# サムネイル画像のテーマ -> 'default' or 'upload'
thumbnail_theme: default

# サムネイル画像の背景画像(1280x670px推奨, なくてもOK)
#thumbnail_image_url: 

# 予約投稿の日時(無い場合は現在時刻を使用)
#posted_at: YYYY-MM-DD hh:mm

先日、ブラウザ拡張機能「 CSV2MD Shortcut 」の v0.2.0 をリリースした 。このバージョンでは新機能として Popup からテキスト変換を行えるようにした。
v0.1.0 では BSW にテキスト変換処理を実装していた。 Popup からテキスト変換を行えるようにするにあたってその処理を BSW から切り出そうとした。が、うまくいかなかった…。
この記事では、そのときの試行錯誤をログとして残す。



該当 issue:

https://github.com/yamamoto-yuta/csv2md-shortcut/issues/35

検証用リポジトリ:

https://github.com/yamamoto-yuta/chrome-extension-injected-code-debug

公式ドキュメントの記載:

For the func key, you can pass in a TS function from your project. It will be transpiled into JS when your extension bundles. You may also use the files key to inject a file from the root of the built bundle.

これを読む限り、ビルド済みファイルに手を加えるしか無さそう…?(であれば、それは管理面倒くさくなりそうなのでやらない方が良さそう…)