1

I have Pacakage 'A' And app 'B'

'Package A'

index.ts
export default "foo"

A's package.json

main: index.ts
types: index.ts

A's tsconfig.json

 "module": "commonjs",

'APP B'

import value from "A"

B's pacakge.json

 "type": "commonjs",

B's tsconfig

 "module": "CommonJS",

My problem is that after typescript compile App B.

It generate plain commonjs which dosen't know how to use export keyword inside of node_modules A.

OK, I understand that.

If so, should I set the main of A's package.json as index.js?

If so, do I have to build every time A changes so that make sure index.js is updated?

That seems too handy....

Is it possible to make package A build together when App B is compiled?

Or any advice please...

MINJA KIM
  • 876
  • 1
  • 8
  • 22
  • what are you using to build? you probably needs some monorepo aware build tool like turborepo/rush/ nx. each tool will need to be configured to be aware of the dependency graph if it cannot be read from the package.json files of each project. – user1852503 Sep 15 '22 at 14:18
  • @user1852503 my tool is turborepo Ok i will go and check turborepo's doc – MINJA KIM Sep 15 '22 at 14:20
  • @user1852503 I think... i need more hint. If this is only matter of "build" i would set "pip" of "turborepo" but i need to manage command "dev" which active watch mode. should i build before start "dev " ? – MINJA KIM Sep 15 '22 at 14:35

0 Answers0