unjs/nitroでこんな感じのディレクトリ構成の場合、
_ignore_dir/*やusers/_ignore_path.tsを無視したいなと思い、
色々調べてみたときの備忘録(*´ω`*)
routes/
_ignore_dir/
index.ts
users/
_ignore_path.ts
index.ts
ドキュメントにはちょろっと書いてあるけど、
ignoreオプションを付けばよいっぽい。
使い方
使い方はこんな感じ。正規表現も使えるっぽい。
//https://nitro.unjs.io/config export default defineNitroConfig({ srcDir: "server", // ignore: ["routes/**/_*", "routes/**/_*/*"], });
nitroのテストコードを見てみると、
こんな感じに書かれているので、routes以外の
middlewareやpublic assetsなども対応しているよう
ignore: [ "api/**/_*", "middleware/_ignored.ts", "routes/_*.ts", "**/_*.txt", "!**/_unignored.txt", ],
以上!! だいぶ書きやすくなる(*´ω`*)