compilation of packages using @vercel/ncc

would like to know if anyone has used @vercel/ncc for compiling packages in a project or framework?

I have recently used this library in our project for compiling packages into single compiled file but getting various issues and compilation errors like:

  • Typescript related error: “files” list in config file tsconfig.json is empty
  • JSX compilation error: you may need an additional loaders to handle the result of these loaders

project structure:

packages/
   packageA/
      node_modules/
      package.json
      tsconfig.json
      src/
         index.ts
         client/
           testComponent.tsx
         server/
           index.js
      dist/

Additionally, after successful compilation of packages how to update the references of each packages from original source to compiled path?

for example –

index.js before:

import ABC from "@package/xyz"

index.js after compilation, reference updated:

import ABC from "./compiled/xyz"