Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strip import statement if all imports are removed. #28

Open
rwjblue opened this issue Mar 25, 2017 · 2 comments
Open

Strip import statement if all imports are removed. #28

rwjblue opened this issue Mar 25, 2017 · 2 comments

Comments

@rwjblue
Copy link
Member

rwjblue commented Mar 25, 2017

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

@krisselden
Copy link
Collaborator

The module is still needed to run tests on prod.

@rwjblue
Copy link
Member Author

rwjblue commented Mar 25, 2017

@krisselden - Only if there are runtime features. If all features are stripped (e.g. they were all true or false, and none are null) the module is not needed at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants