TypeStrong / TypeStrong/ts-loader

ES2015 module issue with transpileOnly + decorators + interfaces

未关闭
#653 32 条评论 26 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

enhancement help wanted pinned should be easy
主要语言
TypeScript
星标
3.5k
派生
439
平均合并
17 小时 17 分钟
30 天内合并 PR
2

描述

Hi there,

We have a very large Angular 2 codebase that we're attempting to move over to ts-loader; we're getting massive (4-5x) speed boosts compared to our existing awesome-typescript-loader setup, but sadly we're getting compilation issues when we turn on transpileOnly.

It only occurs when:

  • Building ES2015 modules AND
  • Using a class with a decorator on it AND
  • The class uses an imported interface AND
  • The imported interface comes from a module that also exports something concrete (e.g. a class or a const)

(webpack complains that it can't find the interface with a stack trace suggesting that it's processing harmony imports.)

I've created a repo with a standalone repro case in it: it's just tiny 2 files both of which are under 10 lines of code:

https://github.com/RoystonS/ts-loader-issue

(Is this related to what's discussed in issue #400?)

Thanks,
Royston.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 github.com/RoystonS/ts-loader-issue 中独立的双文件复现开始,并在启用 transpileOnly 的情况下运行其 webpack 构建。使用 ES2015 模块、一个带装饰器的类,以及从同时导出具体值的模块中导入的接口来复现失败;当这一组合能够在没有缺少接口错误或 harmony-import 错误的情况下完成编译时,即表示完成。

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

评估

技术栈
typescript, webpack
领域
build-system, tooling
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

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