v10 or @emotion/core doesn't run without babel-plugin-transform-inline-environment-variables
See original GitHub issueemotion
version: “@emotion/core”: “^10.0.5”react
version: ^16.7.0-alpha.2
Relevant code:
import React from "react";
const Login = () => {
return (
<section>
<span
css={{
color: "blue"
}}
>
Login
</span>
</section>
);
};
export default Login;
What you did:
I followed the documentation and installed emotion and the css prop babel plugin. I then configured .babelrc
also as mentioned in documentation. FYI., I am using parcel.js
.
- npm i --save @emotion/core
- npm i -D @emotion/babel-preset-css-prop
- .babelrc:
"presets": [
[
"@emotion/babel-preset-css-prop",
{
"autoLabel": true,
"labelFormat": "[local]",
"useBuiltIns": false,
"throwIfNamespace": true,
"sourceMap": false
}
]
]
What happened:
I get the following error in browser console when I navigate to the login
page:
process is not defined
Reproduction: What you did section pretty much captures reproduction steps.
Problem description:
Looks like v10 needs an explicit installation of babel-plugin-transform-inline-environment-variables
which was not needed in previous versions.
Suggested solution:
Bundle babel-plugin-transform-inline-environment-variables
in babel-plugin-emotion
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Cypress v10 Environment Variables - Gleb Bahmutov
Cypress tests have two different sets of values: the config values and the user values. The config values are controlling the test runner ......
Read more >Emotion 11
Emotion 11 is a slight evolution over the Emotion 10. It focuses mainly on the developer experience, TS types improvements, switches internals to...
Read more >Why you shouldn't use @emotion/core - Colin McDonnell
Emotion is my favorite CSS-in-JS library. It's easy to define style classes — both inline or in separate files. You can powerfully compose ......
Read more >Module not found: Can't resolve '@emotion/react'
I had a similar issue and I resolved it by calling: npm install @emotion/react. or yarn add @emotion/react.
Read more >@emotion/react | Yarn - Package Manager
The css prop doesn't work via the babel plugin. jsx can be manually imported from @emotion/core (which can be automated with eslint-plugin-emotion) or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@karol-majewski I had the same issue too. The general feeling I got was that
babel-preset-css-prop
doesn’t play ball withparcel
right now, so I looked into the preset’s source code and adapted it to a fresh.babelrc
which I’m now using instead.For anyone interested: adding
"transform-inline-environment-variables"
in the beginning of the list of plugins in.babelrc
takes care of theprocess is not defined
error.However, the
@emotion/babel-preset-css-prop
preset is still not applying the pragma for me.