griffel
griffel copied to clipboard
babel-preset: multiple modules produce the same import
#103 fixed handling of multiple exports of the same module, but there is an edge case with multiple modules:
import { makeStyles as makeStylesA } from 'module-a'
import { makeStyles as makeStylesB } from 'module-b'
// ⬇️⬇️⬇️
import { __styles } from 'module-a'
import { __styles } from 'module-b' // 💥 duplicate import for "__styles"
This will explode as __styles is duplicated identifier. We should use local imports for this case, i.e. result should be:
import { __styles } from 'module-a'
import { __styles as __stylesB } from 'module-b'
References
- https://github.com/jamiebuilds/babel-handbook/blob/master/translations/en/plugin-handbook.md#scope
- https://github.com/jamiebuilds/babel-handbook/blob/master/translations/en/plugin-handbook.md#generating-a-uid