Skip to content

Spread emotion/react version import #2361

Closed

Description

@felipe-silva-devtech

Is your feature request related to a problem? Please describe.
I'm using rollup to build my application and I'm getting some warning because rollup understands as a global module as can see in the follow image:

image

Describe the solution you'd like
My suggestion is spread the version on import, something like:

import { version as emotionReactVersion } from '@emotion/react/package.json'

...

const __EMOTION_VERSION__ = emotionReactVersion  

Additional context
References:

import packageInfo from '@emotion/react/package.json'

const __EMOTION_VERSION__ = packageInfo.version

Activity

  1. linked a pull request that will close this issuefix: Destructure Emotion version in import #2362on Nov 17, 2022
  2. hasparus commented on Nov 22, 2022

    @hasparus
    Member

    Hey @felipe-silva-devtech, to be frank I don't think that your suggestion fixes your problem.

    It may change the warning text, because packageInfo was inferred from our import, but it doesn't solve anything.

    You are building an UMD build with Rollup, and it expects the package.json from Emotion to be assigned to a global variable. It doesn't know that variable, because you did not set output.globals, and it guesses packageInfo.

    Thing is, I don't think there is such a global variable. Moreover, Theme UI doesn't build to UMD, so there won't be a global variable for it too. Are you confident that you need an UMD build? ESM and CJS builds are usually enough for the most common cases.

  3. locked and limited conversation to collaborators on Nov 22, 2022
  4. converted this issue into a discussion #2367 on Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions