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

[@emotion/babel-preset-css-prop] Component with jsx <></> only, @emotion/core not be imported. #1147

Closed
morlay opened this issue Dec 31, 2018 · 8 comments · Fixed by #1183 · May be fixed by jmm/babel-plugin-jsx-pragmatic#2

Comments

@morlay
Copy link
Contributor

morlay commented Dec 31, 2018

  • emotion version: 10.0.5
  • react version: 16.7

Relevant code:

import * as React from 'react'

export const Demo = (props) => {
    return (
        <>
        </>
    )
}

What you did:

Component with jsx <></> only, @emotion/core not be imported.

What happened:

import { jsx as ___EmotionJSX } from "@emotion/core"

is not added in file.

image

Edit o4olozk90y

Reproduction:

Problem description:

Suggested solution:

@Andarist
Copy link
Member

This is a bug in https://github.com/jmm/babel-plugin-jsx-pragmatic - could u report it over there to see if they can handle it?

@morlay
Copy link
Contributor Author

morlay commented Jan 19, 2019

Hi @Andarist
I could't connect jmm to fix this issue for a long time.
Should we fork that plugin to emotion repo? (publish as @emotion/babel-plugin-jsx-pragmatic)

@Andarist
Copy link
Member

Seems like forking is a way to go now. Would you like to prepare a PR for this?

@morlay
Copy link
Contributor Author

morlay commented Jan 21, 2019

@Andarist I could't run test locally.
should i do something before testing ? to resolve babel-preset-emotion-dev

@Andarist
Copy link
Member

hm, not sure - how does it fail for you?

@morlay
Copy link
Contributor Author

morlay commented Jan 22, 2019

git clone ..
npm install
npx lerna bootstrap
npm test

then got
image

@tkh44
Copy link
Member

tkh44 commented Jan 22, 2019

Try using yarn for best results. I think the issue you are seeing is the packages not being built yet, maybe.
https://github.com/emotion-js/emotion/blob/master/CONTRIBUTING.md#building

@morlay
Copy link
Contributor Author

morlay commented Jan 22, 2019

@tkh44 Thanks.
But i failed for installing puppeteer, may be blocked by the GFW of china.
image
I will try some use machine outsides china later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants