developit / developit/microbundle

Transpiling local package dependencies that use TS file as entry point

未关闭
#845 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
TypeScript upstream
主要语言
JavaScript
星标
8.1k
派生
358
PR 合并指标
30 天内没有已合并 PR

描述

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?

贡献指南

这个仓库没有索引到贡献指南

调研方向

Start by reproducing the failure with the linked packages-publishing-sample monorepo, where package b depends on package a and a uses src/index.ts as its entry point. Read how microbundle handles dependencies during bundling and compare the stated dist/index.js and local-TypeScript entry-point alternatives. Done requires a documented, agreed behavior for local TypeScript dependencies and a passing reproduction.

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript, typescript
领域
build-system, tooling
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
28/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。