-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Setup for sourceMap support for dev environment #2101
Conversation
…is approach with core team
# This is the 1st commit message: support adding sourcemap to styled components # This is the commit message styled-components#2: added a single unit test for sourcemap, will add more when confirm this approach with core team
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this approach makes sense to me, I'm excited to see where this'll go!
I published an experimental version of this under |
…king on making createRehydrationTag not combine tags
Amazing! 😍😍😍 Can't wait to land this 👏 |
Just make sure all the code is inside NODE_ENV !== 'production' checks and it should be omitted |
…dd sourcemap to sandbox babel
|
Looks like I haven't handled some edge cases. I will work on them |
Closing since this has gone very stale for now. I don't think there's been a big need or shout from CSS-in-JS users, calling this a must-have anymore, as browser's CSS devtools get better. But we'll observe and see what happens to this. |
I created this merge request to get feedback on my approach. Let me know if I missed anything.
As discussed in this issue, the source map support will only be available for dev environment for two reasons:
Changes need to be made to both the styled-components repo and the babel-plugin-styled-components repo
In this repo (with this merge request), I added support to pass sourceMap into styled component with
withConfig
This should generate a style tag that contains rules only for this component
The second part of the work would be done in babel plugin repo to generate those sourceMap comment.
Because this uses
withConfig
, looks likeinjectGlobal
andkeyframe
don't support it.Edit: Since we are switching to
createGlobalStyle
, I will take a look at if I can add sourcemap to it