個人的メモ
Next.jsのビルド時にテスト用のファイル等がLintエラーを吐いて終了する場合があった。以下の方法でStorybookやテスト用ファイルをビルド対象から外す。
ビルド用のtsconfig.build.jsonなどを作成し、next.config.jsでそちらを使うように設定する。
tsconfig.build.json
{
    "extends": "./tsconfig.json",
    "exclude": [
        "node_modules",
        "**/*.test.tsx",
        "**/*.spec.tsx",
        "**/*.stories.tsx",
        "**/*.test.ts",
        "**/*.spec.ts",
        "**/*.stories.ts"
    ]
}
next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
  typescript: {
    tsconfigPath: "tsconfig.build.json",
  },
};
module.exports = nextConfig;






 who shares tips on Tech, Productivity, Design, and much more!
 who shares tips on Tech, Productivity, Design, and much more!
