とりあえずできた。
のように md 記事と同じフォルダに画像を配置する運用。 紆余曲折。
routing match (dev用)
もともと、+page.server.ts
には画像ファイルに対するリクエストは来ていて、
エラーになっていた。
svelte.config.js
この画像に対するリクエストを捌けるようにした。
posts/[...slug]
を、
posts/[...slug=isAsset]
と posts/[...slug=isNotAsset]
に振りわけて、
isAsset
の方は、画像の byte 列を含む Resonse を返すようにすることができた。
posts/[...slug=isAsset]/+server.ts
routing を match する
高度なルーティング • Docs • SvelteKit
https://kit.svelte.jp/docs/advanced-routing#matching
src/param/isAsset
src/param/isAsset
+server.ts と +page.server.ts の違い
+page.server.ts
は stringify できる JsonObject を返すことが期待される。
+server.ts
は HttpResponse を直接返す。byte 列なども扱える。
rollup-plugin-copy(build用)
Before you use this plugin, consider using public directory or import in JavaScript. In most cases, these will work.
わかるんだが、とりあえず動く方法として。
vite.config.ts