Deno でやるフロントエンド

0.9K Views

February 27, 25

スライド概要

Deno を使ってフロントエンドの実装をする環境について、
SPA/MPA、各種フレームワークの対応具合を概観します。

profile-image

虎の穴ラボ株式会社は、主にとらのあな関連サービスのシステム開発を専門に担う、エンジニアの会社です。

シェア

またはPlayer版

埋め込む »CMSなどでJSが使えない場合

関連スライド

各ページのテキスト
1.

TORANOANA Lab Deno でやるフロントエンド Meguro.es #29 @oRo 2025/2/27 虎の穴ラボ株式会社 奥谷 一陽 Copyright (C) 2024 2023 Toranoana Lab Inc. All Rights Reserved.

2.

自己紹介 奥谷 一陽 所属:虎の穴ラボ株式会社 興味:Deno、TypeScript 最近届いたもの:クモノスレイヤー -MEMORIAL EDITION X:@okutann88 github:Octo8080X toranoana.deno 運営の1人 Copyright (C) 2024 2023 Toranoana Lab Inc. All Rights Reserved.

3.

はじめに Copyright (C) 2024 2023 Toranoana Lab Inc. All Rights Reserved.

4.

Deno 使ってる? Copyright (C) 2024 2023 Toranoana Lab Inc. All Rights Reserved.

5.

Denoとは - Node.js 作者のライアンダールが作者 現在 Deno Land inc で開発 OSS 特徴 - パフォーマンス - ツール群を含んだ1ファイルで提供される - ランタイム自身で、バージョン管理(上げ下げ)ができる - TSをセットアップ無しで書き始められる - Key-Valueストアをランタイムに持つ - Deno Deployというホスティングサービスを持っている などなど Copyright (C) 2024 2023 Toranoana Lab Inc. All Rights Reserved.

6.

https://deno.com/ Copyright (C) 2024 2023 Toranoana Lab Inc. All Rights Reserved.

7.

実際どうなの? Deno でフロントエンド Copyright (C) 2024 2023 Toranoana Lab Inc. All Rights Reserved.

8.

実際どうなの? Deno でフロントエンド 「Deno でフロントエンドをやる」にもパターンがある。 - シンプル1枚ページ - SPA - MPA - 薄いフレームワーク - 手厚いフレームワーク Copyright (C) 2024 2023 Toranoana Lab Inc. All Rights Reserved.

9.

公式では.... https://deno.com/blog/web-frameworks-on-deno 2023年時点で、各種フレームワークを扱うことができるものとして表明している。 Copyright (C) 2024 2023 Toranoana Lab Inc. All Rights Reserved.

10.

直近 対Next https://github.com/denoland/deno/pull/26720 対Nuxt https://github.com/denoland/deno/pull/27086 現在も、各フレームワークの機能を動かすための改善(=Node.js互換性)の向上 が図られている。 Copyright (C) 2024 2023 Toranoana Lab Inc. All Rights Reserved.

11.

シンプル1枚ページ、SPA、MPA > deno run -RWE npm:create-vite-extra@latest deno-vanilla deno-vue deno-react deno-preact deno-lit deno-svelte deno-solid Done. Now run: cd app deno task dev Copyright (C) 2024 2023 Toranoana Lab Inc. All Rights Reserved.

12.

シンプル1枚ページ、SPA、MPA > deno run -RWE npm:create-vite-extra@latest deno-vanilla deno-vue deno-react deno-preact deno-lit deno-svelte deno-solid Done. Now run: cd app deno task dev vite.config.mts 置いて、調整すればマルチページアプリも可能 Copyright (C) 2024 2023 Toranoana Lab Inc. All Rights Reserved.

13.
[beta]
シンプル1枚ページ、SPA、MPA + API
API が欲しければ、つくれば良い。

import { serveDir } from "@std/http";
import { type Context, Hono } from "@hono/hono";
const app = new Hono();

Deno でAPIサーバーを立ててしまう。app.get("/api/get_time", (_c: Context) => {
> deno task build --watch
> deno serve --watch -R server.ts
で両立。

return new Response(new Date().toISOString());
});
app.get("/*", (c: Context) => {
return serveDir(c.req.raw, {
fsRoot: "dist",
});
});
export default {
fetch(req: Request) {
return app.fetch(req);
},
} satisfies Deno.ServeDefaultExport;

Copyright (C) 2024
2023 Toranoana Lab Inc. All Rights Reserved.

14.
[beta]
Deno 2.2 でさらに楽になった
{
"tasks": {
"dev": "deno run -A --unstable --node-modules-dir npm:vite",
"build": "deno run -A --unstable --node-modules-dir npm:vite build",
"preview": "deno run -A --unstable --node-modules-dir npm:vite preview",
"serve": "deno run --allow-net --allow-read https://deno.land/[email protected]/http/file_server.ts dist/",
"server": "deno run --allow-net --allow-read server.ts",
"sync:build": "deno run -A --unstable --node-modules-dir npm:vite build --watch",
"sync:serve": "deno serve -R server.ts"
},
"lint": {
"exclude": ["dist", "node_modules", ".vite"],
"plugins": [
]
}
}

> deno task sync:*
でまとめてビルドとサーバーアプリをまとめて起動できる
Copyright (C) 2024
2023 Toranoana Lab Inc. All Rights Reserved.

15.

薄い?フレームワーク Copyright (C) 2024 2023 Toranoana Lab Inc. All Rights Reserved.

16.

薄い?フレームワーク SSR ディレクトリベースルーティング islands architecture Partials… (本当に薄い?かは置いておき) さっと作るのに向いている。 Copyright (C) 2024 2023 Toranoana Lab Inc. All Rights Reserved.

17.

Fresh で作る イベントページや https://deno-fest-2023.deno.dev/ Copyright (C) 2024 2023 Toranoana Lab Inc. All Rights Reserved.

18.

Fresh で作る アプリや https://pile-up.deno.dev/ Copyright (C) 2024 2023 Toranoana Lab Inc. All Rights Reserved.

19.

Fresh で作る 自作モジュールのドキュメントサイト https://thoth-doc.deno.dev/ Copyright (C) 2024 2023 Toranoana Lab Inc. All Rights Reserved.

20.

大きなフレームワーク Copyright (C) 2024 2023 Toranoana Lab Inc. All Rights Reserved.

21.

大きなフレームワーク 皆さんご存じ next.js Copyright (C) 2024 2023 Toranoana Lab Inc. All Rights Reserved.

22.

大きなフレームワーク > deno -RWNES npm:create-next-app@latest ~オプション設定省略~ > cd next-app >deno run dev 起動する。 Copyright (C) 2024 2023 Toranoana Lab Inc. All Rights Reserved.

23.

大きなフレームワーク ローカル起動だけではなく、公式がDeno Deployに展開する方法の紹介もしている。 https://deno.com/blog/nextjs-on-deno-deploy Copyright (C) 2024 2023 Toranoana Lab Inc. All Rights Reserved.

24.

Tanstack 最近ドキュメントにTanstackについての記述も追加されたので興味あればぜひ https://docs.deno.com/examples/tanstack_tutorial/ Copyright (C) 2024 2023 Toranoana Lab Inc. All Rights Reserved.

25.

まとめ - Deno でフロントエンド(含む)開発は、結構いける in 2025 - フロントの開発もいろいろ選択肢があるが、 - シンプル1枚ページ - SPA - MPA - 薄い?フレームワーク - 大きなフレームワーク など各種選択肢をかなりカバーできる。 Copyright (C) 2024 2023 Toranoana Lab Inc. All Rights Reserved.

26.

お知らせ1-同人誌 今回紹介しきれてないアプリの開発を紹介する記事を書いてます。 Copyright (C) 2024 2023 Toranoana Lab Inc. All Rights Reserved.

27.

ありがとうございました Copyright (C) 2024 2023 Toranoana Lab Inc. All Rights Reserved.

28.

宣伝! Copyright (C) 2024 2023 Toranoana Lab Inc. All Rights Reserved.

29.

3/14 大井町で Deno のイベントをやります! 豪華ゲストスピーカーを迎えて開催します! Copyright (C) 2024 2023 Toranoana Lab Inc. All Rights Reserved.