import esbuild from "esbuild";
import { sentryEsbuildPlugin } from "@sentry/esbuild-plugin";

const hasToken = typeof process.env.SENTRY_AUTH_TOKEN === "string";

esbuild.build({
  plugins: hasToken
    ? [
        sentryEsbuildPlugin({
          authToken: process.env.SENTRY_AUTH_TOKEN,
          org: process.env.SENTRY_ORG,
          project: process.env.SENTRY_PROJECT,
        }),
      ]
    : undefined,
  sourcemap: hasToken,
});
