0

I want to create lerna monorepo which includes a few packages. But i don't want to compile every package with tsc. This means that i want to export tsx-ts files directly in package.json files' "main" section. And consume these ts files directly from main package. So i can debug what i write in chrome dev tool.

Can you help me.

This is one of my packages' package.json file:

{
  "name": "w-cmp-lib",
  "version": "1.0.0",
  "description": "",
  "main": "index.ts",  
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "react": "16.3.2"
  }
}
mehmet baran
  • 636
  • 8
  • 18
  • 1
    I'm not sure if it's possible but this defies the point of breaking a project to multiple packages. *So i can debug what i write in chrome dev tool* - if this serves debugging purpose, you possibly have XY problem, consider addressing it instead. – Estus Flask May 18 '18 at 06:18
  • Thx @estus. Actually if it is possible, many problems will be solved for me. For example i have to run tsc for every package which i have changed. Anyway, i will try adjust my setup to debug tsx-ts file on chrome. – mehmet baran May 18 '18 at 06:34
  • 1
    See https://github.com/Microsoft/TypeScript/issues/14479 and https://github.com/Microsoft/TypeScript/pull/22658 , I guess this covers your case. `--declarationMap` option should be already available in `typescript@next`, but I'm not sure if .d.ts.map files can be consumed automatically during build process or need additional actions – Estus Flask May 18 '18 at 06:43
  • i will look at them. Thank you estus – mehmet baran May 18 '18 at 06:45
  • You should use Project References. See [the second half of this answer, under "this is great for monorepos"](https://stackoverflow.com/a/61467483/8910547) – Inigo Apr 29 '20 at 01:24

0 Answers0