When tsc Compiled to ES3
7月 24, 2021
·
1 分钟阅读时长
·
97
字
·
-阅读
-评论
During a CD deployment our web bundle unexpectedly compiled to ES3, causing a blank screen in browsers.

Root Cause
A shared business component library ignored the main project’s tsconfig target. Our internal build tool picks the first tsconfig it finds; the component library lacked a target, so TypeScript defaulted to ES3. Remember: TypeScript only transpiles syntax—it doesn’t polyfill.
Fix
Compile component libraries to JavaScript before publishing. This:
- Speeds up app builds (libraries are precompiled).
- Ensures libraries aren’t affected by the host project’s
tsconfig.
Final Thoughts
Lesson learned—always set explicit targets or ship compiled artifacts for shared packages.

