ember-cli / ember-cli/babel-plugin-debug-macros

Strip import statement if all imports are removed.

未关闭
#28 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
13
派生
13
PR 合并指标
30 天内没有已合并 PR

描述

Currently, given:

```js
import { SOME_FLAG } from 'blah/features';

if (SOME_FLAG) {
console.log('whatever');
}
```

With this config:

```js
{
plugins: [
['babel-debug-macros', {
features: {
name: 'blah',
source: 'blah/features',
flags: { SOME_FLAG: true }
},
}]
]
}
```

We remove the usage of `SOME_FLAG`, but leave the import statement. This forces us to also emit a `blah/features` module even if we never have runtime enableable features.

IMO, we should remove imports if they are no longer used...

贡献指南

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

调研方向

Issue 中没有指定文件或测试。首先定位处理来自已配置 feature source 的导入的 babel-debug-macros transform,然后复现移除 SOME_FLAG 后的示例。完成的标准是:移除所有导入的 flag 后,生成的输出不再保留该导入,同时现有的 feature-removal 行为保持不变。

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

评估

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

把新 issue 发到你的邮箱

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