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

Strip import statement if all imports are removed.

Open
#28 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
13
Forks
13
PR merge metrics
No merged PRs in 30d

Description

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...

Contributor guide

No contributing guide indexed for this repository

Research direction

No file or test is named in the issue. Start by locating the babel-debug-macros transform that processes imports from the configured feature source, then reproduce the example with SOME_FLAG removed. Done means the generated output no longer retains the import when all imported flags are removed, while the existing feature-removal behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.