編集

Deno v2.4 リリース、deno bundle 復活とテキスト・バイトインポート

Deno v2.4 がリリース。deno bundleサブコマンドが復活し、JavaScript や TypeScript から単一ファイルの JavaScript バンドルを作成できるようになった。npm や JSR の依存関係をサポートし、esbuild による自動的な Tree Shaking と minification を含む。

bash
# minification付きでバンドル
$ deno bundle --minify main.ts

# ブラウザプラットフォーム用に設定
$ deno bundle --platform browser --output bundle.js app.jsx

テキストとバイトファイルのインポート機能が追加され、--unstable-raw-importsフラグを使用してデータファイルを JavaScript モジュールグラフにリンクできる。

javascript
import message from "./hello.txt" with { type: "text" };
import bytes from "./hello.txt" with { type: "bytes" };
import imageBytes from "./image.png" with { type: "bytes" };

組み込み OpenTelemetry が安定版になり、--unstable-otelフラグが不要になった。OTEL_DENO=1環境変数を設定することで、ログ、メトリクス、トレースの自動収集が可能。

出展:Deno 2.4: deno bundle is back

編集