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
[v6] ::placeholder & keyframes rejected in production build with enableVendorPrefixes
#4007
Comments
Hi @mAAdhaTTah can you please use LTS version of styled-components which is Also without your code snippet it's hard to understand what you are trying to explain. |
@Sambhav399 I can't use the LTS version because I'm trying to upgrade to React 18, which didn't work with v5, hence starting the upgrade to v6. As for a code snippet, I can try to provide a fuller example (this one doesn't seem to run after exporting from CodeSandbox), but basically I have an input that looks like this. The |
Ok, I have a reproduction example in this repo: https://github.com/mAAdhaTTah/sc-issue-4007 If you git clone, |
hi @mAAdhaTTah It's working fine on my side. |
I have updated the original issue with the reproduction & steps to reproduce, highlighting the difference in behavior between dev & production mode. |
I'm also experiencing a keyframes bug in production. I've updated the example to include that issue. |
@probablyup Happy to spend some time on this myself or put a dev on this if you're able to give us a lead as to where the issue might be. |
Usually when something doesn't work in production but does work locally it's because the CSSOM API rejected a rule we tried to insert. If you put a debugger here you should be able to see the rule as it fails the |
That being said, it seems to work with latest SC: https://codesandbox.io/s/styled-components-v6-sandbox-forked-n9bkqn?file=/src/App.tsx |
@probablyup CodeSandbox runs in development mode so it won't be reproducible there. I'll take a look at the try/catch block. |
I was able to extract an error from the build version:
My guess is this is because we have |
enableVendorPrefixes
I've update the title (again!) to reflect the underlying issue. |
Edit: nvm see the repro, but it doesn't match what you posted as an error as there is no |
@probablyup No, sorry, I got the repro from my actual application, not the repro. I can grab from there if that's helpful. |
Here's the errors from the reproduction:
|
Can also confirm that adding |
Ah, I see. The vendor prefixed styles are supposed to be inserted separately, will look into it. |
Could y'all try |
Nvm I found some further problematic scenarios... need to spend more time on it |
Ok great, happy to test or help out if there's anything I can do here. |
I'm kind of stuck due to some stylis behavior... basically the way stylis's prefixer works in v4 is the vendor-prefixed styles get stringified together into a lump instead of being emitted as separate discrete rules. This by itself is not hard to work around, but when you add wrappers like @Andarist if you guys figured out a workaround for this would love to know. I see emotion pinned the prefixing engine to an earlier iteration but I suspect you'll have the same issue as CSSOM injection time if multiple prefixes are in the same committed rule? |
what exact call throws in the browser? what exact arguments are being passed to the browser API? in Emotion we wrap |
Haha sorry, will write up something more cohesive to use moving forward for discussion |
This has been partially resolved in RC.3. See the release notes for more info, there's some work that needs to happen on the stylis side for complete resolution. |
This fully fixes the issue originally discovered in #4007
Awesome, thank you for the fix! Can confirm the test case is resolved as well. |
Environment
System:
Binaries:
Reproduction
https://github.com/mAAdhaTTah/sc-issue-4007
Steps to reproduce
localhost:3000
npm run build && npx serve build
localhost:3000
Expected Behavior
::placeholder
works in dev & prod mode.Actual Behavior
::placeholder
is stripped in prod mode.The text was updated successfully, but these errors were encountered: