-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Remove comments from styles in babel-plugin-emotion #650
Remove comments from styles in babel-plugin-emotion #650
Conversation
Codecov Report
|
Hi @mitchellhamilton, Is this supposed to work with From my testing I am still seeing inline comments like the one below appearing in my CRA 3.1.1 production bundle. import styled from '@emotion/styled/macro'
export const StyledTest = styled.div`
position: absolute;
overflow: hidden;
top: 0;
left: 0;
bottom: 0;
right: 0 ;
/* This comment should not be in production bundles */
` |
Should work the same, could you prepare a repro case (runnable repository) that could be investigated? |
Hi @Andarist thanks for the quick reply! I'll try to follow tomorrow. |
Hi @Andarist, so after further investigation I realized that my issue is that since I'm writing a component library - my components are only compiled with typescript and so there's no babel in the process until lib files are consumed by a real CRA. But by then it's too late. Unless there's some similar macro for ts files I think I'll have to invent one. |
Well - with CRA, unfortunately, you have limited configuration possibilities. You'd have to compile your component library with both TS and babel (which shouldn't be that hard to setup - it might be worth doing). |
@Andarist yup, that's exactly what I did. The article I linked above and this https://github.com/Microsoft/TypeScript-Babel-Starter were both very helpful in getting me there. |
What:
Remove comments from styles in babel-plugin-emotion
Why:
Closes #647 + the comments won't be included in prod so bundles will be smaller
How:
Use some stuff from babel-plugin-styled-components and put it into
@emotion/babel-utils
and use that here.Checklist: