construct-style-sheets icon indicating copy to clipboard operation
construct-style-sheets copied to clipboard

SyntaxError in Safari

Open konstantinkreft opened this issue 2 years ago • 3 comments

Describe the bug When using this polyfill (>= v3.0.4) Safari throws a SyntaxError: The string did not match the expected pattern. which results in not applying any styles. I can only reproduce this error when using the polyfill with twind. So it could also be a bug of twind but it works with [email protected] so I'm not really sure.

Safari is highlighting these lines in the error.

https://github.com/calebdwilliams/construct-style-sheets/blob/e6c517754845ed32f42df10d456d521aeebebd52/src/ConstructedStyleSheet.ts#L133-L135

To Reproduce Steps to reproduce the behavior: Preview with error in console CodeSandbox

Expected behavior To not throw SyntaxError: The string did not match the expected pattern.

Desktop (please complete the following information):

  • OS: [macOS]
  • Browser [safari]
  • Version [15.4]

Additional context This error only occurs when using with twind so I'm not entirely sure which package is to blame 🤷‍♂️ It is working up until version 3.0.3 of construct-style-sheets-polyfill.

konstantinkreft avatar Apr 28 '22 12:04 konstantinkreft

@konstantinkreft Hello, I am a senior at Clemson University completing a Bachelor's in Computer Science. Would I be able to help assist in this Issue? For my final assignment I need to contribute to an active repository and I believe I would be a good resource for this issue as I have good experience in React.

PlusUltra404 avatar Apr 28 '22 14:04 PlusUltra404

@PlusUltra404 Yeah, I'd be happy to field a PR from this. Let me know if you need anything including help in figuring out what's going on. I think I might know (hint there's a former PR or issue that might be related).

calebdwilliams avatar Apr 28 '22 14:04 calebdwilliams

@PlusUltra404 Sure, that would be great!

Since it breaks with v3.0.4 we can narrow it down to this commit: https://github.com/calebdwilliams/construct-style-sheets/commit/4e03571ba5822f6208a68e62f29a5d25d310b581

konstantinkreft avatar Apr 28 '22 19:04 konstantinkreft