typescript - Docker ile Nextjs Derlemesi Sırasında Can’t Resolve .... Hatası Nasıl Çözülür?


#Dockerfile
FROM node:20-alpine AS installer

WORKDIR /next_app

COPY src/package.json ./

RUN apk add --update python3 make g++ gcc fftw-dev libc6-compat
RUN apk add --update --repository http://dl-3.alpinelinux.org/alpine/edge/testing vips-dev
RUN rm -rf /var/cache/apk/*

RUN npm install --production

FROM installer AS builder

WORKDIR /next_app

COPY src/. .

RUN npm run build

FROM node:20-alpine

WORKDIR /next_app

COPY --from=builder /next_app/.next ./.next
COPY --from=builder /next_app/node_modules ./node_modules
COPY --from=builder /next_app/package.json ./package.json

COPY src/.env .

ENV NODE_ENV production
ENV PORT 3000
ENV NEXT_SHARP_PATH /tmp/node_modules/sharp

EXPOSE 3000

CMD ["npm", "start"]

#tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "incremental": true,
    "plugins": [
      {
        "name": "next"
      }
    ],
    "baseUrl": ".",
    "paths": {
      "@/ui/*": [
        "ui/*"
      ],
      "@/lib/*": [
        "lib/*"
      ],
      "@/styles/*": [
        "styles/*"
      ],
      "@/app/*": [
        "app/*"
      ]
    },
  },
  "include": [
    "next-env.d.ts",
    "**/*.ts",
    "**/*.tsx",
    ".next/types/**/*.ts",
    "../tailwind.config.ts"
  ],
  "exclude": [
    "node_modules"
  ]
}
#next.config.js

const nextConfig = {
    reactStrictMode: true,
    swcMinify: true,
    webpack(config) {
        config.resolve.fallback = {
            ...config.resolve.fallback,
            fs: false,
        };
        config.resolve.alias.canvas = false;
        config.module.rules.push({
            test: /\.node$/,
            use: 'node-loader',
        });

        return config;
    },
    images: {
        remotePatterns: [
            {
                protocol: 'https',
                hostname: 'xxxxxxx',
                port: '',
                pathname: '/assets/**',
            },
        ],
    },
    sentry: {
        hideSourceMaps: true,
    },
};

Nextjs uygulamamı docker kullanmadan inşa ettiğimde her şey sorunsuz çalışıyor. Ama inşa etmeye çalıştığımda şu tür hatalar alıyorum

Modül bulunamadı: 'app/lib/send_request' çözümlenemiyor

npm run build sırasında birden fazla dosya için. Daha önce aynı docker dosyasını kullanıyordum ve çalışıyordu, şimdi projemi App dizinine taşıdım ve bu hataları almaya başladım.