developit / developit/microbundle

Transpiling local package dependencies that use TS file as entry point

Offen
#845 6 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
TypeScript upstream
Vorherrschende Sprache
JavaScript
Sterne
8.1k
Forks
358
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Hi, consider a monorepo that has some TypeScript packages kept in `packages/*`. Now one of these packages, let's call it `b`, depends on package `a`. Package `a` has entry point set as TS file e.g. `src/index.ts.`. When trying to bundle such package `microbundle` fails since it cannot transpile package `a` as it's declared as a dependency of `b` and thus it's expected that the package is already bundled up.

I could think of the following solutions:
1. Only use published npm packages as dependency.
2. Always point main entry to bundle e.g. dist/index.js.
3. Keep using TS files as main entry but when bundling, use bundled version i.e. dist/index.js.

I have prepared a small sample monorepo illustrating the issue https://github.com/karolisvram/packages-publishing-sample/ but so far haven't decided on the best solution as all have drawbacks. Ideally, mirobundle would transpile its local dependencies too but as far as I can tell, it's not supported? Any there any other alternatives that I'm missing?

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.