Skip to content

Strip import statement if all imports are removed. #28

@rwjblue

Description

@rwjblue

Currently, given:

import { SOME_FLAG } from 'blah/features';

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

With this config:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions