0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

SvelteKitで開発中に「Error: No route matches URL "/.well-known/appspecific/com.chrome.devtools.json"」が出る場合の対処法

Posted at

この記事はなに?

急にSvelteKitで開発中に「Error: No route matches URL "/.well-known/appspecific/com.chrome.devtools.json"」が出てきて迷惑だったので対処法をまとめた記事です。

対処法 (とりあえず無効化したい場合)

以下のURLをChromeにそれぞれペーストしてアクセスし、設定項目をDisabledにする。

chrome://flags#devtools-project-settings
chrome://flags#devtools-automatic-workspace-folders

スクリーンショット 2025-06-30 9.36.26.png

対処法 (特定のSvelteKitのプロジェクトで無効化したい場合)

リクエストを自分で処理することで、ウェブサーバーがアプリケーションのすべての開発者に受信リクエストに関する通知を発行しないようにすることができます。

src/hooks.server.js
import { dev } from '$app/environment';

export function handle({ event, resolve }) {
	if (dev && event.url.pathname === '/.well-known/appspecific/com.chrome.devtools.json') {
		return new Response(undefined, { status: 404 });
	}

	return resolve(event);
}

これってそもそも何?

Google Chrome 135で追加されたローカル開発サーバーで動かしているプロジェクトのソースコードを、Chrome DevToolsの「Sources」パネルから直接編集・保存できるようにするための機能

対処法 (有効化する場合)

以下のコマンドを実行してvite-plugin-devtools-jsonをインストールし、設定します。
vite-plugin-devtools-json は、開発サーバーでChromium DevToolsプロジェクト設定ファイルをオンザフライで生成するための Vite プラグインです。このファイルは/.well-known/appspecific/com.chrome.devtools.jsonから提供され、Chromiumブラウザにプロジェクトのソースコードがどこにあるかを伝えます。

npx sv add devtools-json
vite.config.js
import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig } from "vite";
import devtoolsJson from "vite-plugin-devtools-json";

export default defineConfig({
  plugins: [sveltekit(),devtoolsJson()],
});

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?