codesandboxer
codesandboxer copied to clipboard
Import parsing pulls in commented out imports
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.
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.