Skip to content

babel-preset: multiple modules produce the same import #104

Description

@layershifter

#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

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐞 bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions