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

Import parsing pulls in commented out imports #25

Open
tikotzky opened this issue Jun 7, 2018 · 1 comment
Open

Import parsing pulls in commented out imports #25

tikotzky opened this issue Jun 7, 2018 · 1 comment

Comments

@tikotzky
Copy link

tikotzky commented Jun 7, 2018

for example a file that looks like

// import colors from '../colors';
import Dropdown from '../Dropdown';

will try to include both colors and Dropdown in the codesandbox when only Dropdown is being used.

@Noviny
Copy link
Collaborator

Noviny commented Jun 8, 2018

Thanks for raising this!

Because we are currently using regex to match imports, determining whether an import is in a comment (or in a string) is near impossible, for example:

/*
import colors from '../colors'
*/

we need a solid way to detect they are in a comment block.

I've got a task to look at the cost of using babel to parse files instead of regex matching for imports, as it would allow us to be way more reliable about edge case matches. Will update this issue once I have a clear idea of the cost/benefits of moving to full AST parsing.

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