styled-components / xstyled

A utility-first CSS-in-JS framework built for React. šŸ’…šŸ‘©ā€šŸŽ¤āš”ļø
https://xstyled.dev
MIT License
2.28k stars 105 forks source link

Not working on IE11 in case use xstyled 2.3.0 and later #247

Closed strozw closed 3 years ago

strozw commented 3 years ago

šŸ› Bug Report

IE11 & core-js is not support RegExp dotAll flag.

So IE11 throw Error: TypeError: Syntax error in regular expression in xstyled 2.3.0 and later.

Probably need to fix the following code to resolve this issue. https://github.com/gregberge/xstyled/blob/main/packages/core/src/transform.ts#L32

For example, stop using the dotall flag and use [\s\S] instead of .. https://stackoverflow.com/questions/1068280/javascript-regex-multiline-flag-doesnt-work

To Reproduce

To transpile application by babel 7 & core-js 3, that using xstyled 2.3.0 and later. and exec on IE11.

Expected behavior

Woking on IE11

Link to repl or repo (highly encouraged)

Sorry, I'm not ready yet.

Run npx envinfo --system --binaries --npmPackages @xstyled/system,@xstyled/styled-components,styled-components --markdown --clipboard

## System:
 - OS: macOS 11.2.3
 - CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
 - Memory: 15.57 GB / 64.00 GB
 - Shell: 5.8 - /usr/local/bin/zsh
## Binaries:
 - Node: 14.15.4 - ~/.asdf/installs/nodejs/14.15.4/bin/node
 - Yarn: 1.22.10 - /usr/local/bin/yarn
 - npm: 6.14.10 - ~/.asdf/installs/nodejs/14.15.4/bin/npm
 - Watchman: 4.9.0 - /usr/local/bin/watchman
## npmPackages:
 - @xstyled/styled-components: 2.4.1 => 2.4.1
 - styled-components: 5.2.3 => 5.2.3
agriffis commented 3 years ago

Thanks!

agriffis commented 3 years ago

@gregberge I put the fix for this on main and next. Do you want to make a v2 release?

gregberge commented 3 years ago

Fixed in v2.5