This bounty involves fixing an ESM import issue in a JavaScript/TypeScript UI package within a monorepo. The core problem is that the package's `main` entry point points to a TypeScript source file, and its components are not properly exported as compiled JavaScript for direct consumption by Node.js ESM clients. The task requires configuring the build process to emit valid JavaScript entrypoints and TypeScript declarations.
A starter prompt for Claude Code, what you'll need, and how to reach them.
You are an expert TypeScript/Node.js developer. The goal is to fix a package entrypoint issue in a monorepo. I need you to address issue #2787 in the `SecureBananaLabs/bug-bounty` repository, specifically for the `@freelanceflow/ui` package. The problem is that `main` points to `src/index.ts` and components like `./Button` and `./Card` are re-exported from it without emitted JavaScript entrypoints, causing Node.js ESM consumers to fail. Your task is to modify the package's build configuration to correctly compile TypeScript to JavaScript, generate declaration files, and ensure the `package.json` `main`, `module`, and `types` fields correctly point to the compiled output, enabling direct ESM imports from Node.js. Focus on using `tsup` or `rollup` as the bundler if not already present, ensuring proper `exports` map in `package.json` if needed. Provide the necessary code changes, build script updates, and a detailed explanation of the fix. The final deliverable must pass the test `node -e "import('@freelanceflow/ui')"` without errors. Use Next.js 16 App Router, React 19, Tailwind v4 as the conceptual framework for general web components, though the specific fix is for a generic JS package.Bounty (amount on the issue). ## Bug The `@freelanceflow/ui` workspace package currently declares `main` as `src/index.ts`, and that file re-exports `./Button` and `./Card` without emitted JavaScript entrypoints. This makes the package fail when imported directly by a Node/ESM consumer from the workspace: ```sh node -e "import('@freelanceflow/ui')" ``` It currently errors because the package entrypoint points at TypeScript source and the component modules are not resolvable as runtime JavaScript. The package should expose a real JavaScript entrypoint while preserving TypeScript declarations for consumers. --- This issue is limited only to the creator of this issue. This means that only the issue author can attempt to solve this issue. If you would like to work on it, please create another issue with the same contents and refer to issue #743 for more information. Parent bounty: #743
Standard for any dev work.
Standard JavaScript development environment.
Essential for fixing TypeScript specific issues.
May need to learn specific monorepo commands and conventions - ~half a day.
Learn it: Search getting-started ↗
Deep dive into `package.json` field specifics and module resolution in Node.js - ~half a day.
Learn it: Search getting-started ↗
Create a new GitHub issue with the same contents as #2787, as instructed, and refer to #743. Then, comment on your *new* issue to signal intent to work on it.
“I've reviewed the issue regarding the `@freelanceflow/ui` package entrypoint. I can implement the correct TypeScript compilation and `package.json` configuration to resolve the ESM import error. I've created a new issue for this, as instructed, and am ready to deliver a working fix.”
Open the original ↗