sql-formatter icon indicating copy to clipboard operation
sql-formatter copied to clipboard

Sql-Formatter plugin can not work in IE browser

Open xm-c opened this issue 2 years ago • 3 comments

In IE browser,it is report error msg. image

whether this plugin can support IE, when the version is greater than 2.3.4 ?

xm-c avatar Aug 30 '22 02:08 xm-c

Yes. IE is not supported, as SQL Formatter is built with ES6 target, which isn't supported by IE.

If you need IE support, you have the option to compile it with Babel to ES5.

https://kangax.github.io/compat-table/es6/

nene avatar Aug 30 '22 04:08 nene

@nene I try compile it with Babel to ES5, but I found it also can not work in IE, because The Babel cannot transform unicode regex. so. It there any way to compile it?

xm-c avatar Sep 06 '22 07:09 xm-c

What about using regexpu to transform these regexes to ES5?

I suspect though that the main problem is that sql-formatter builds lots of regexes dynamically, and those can't be detected by the transformation tools.

I think there are really only a few places where we really need these unicode regexes. The main one being matching of identifiers. And this part definitely can't be transformed, as it's not part of a /regex-literal/u.

I think it should be possible to eliminate most of our current unicode regexes (or maybe only use them when unicode support is detected in browser). I'll reopen this issue to reconsider.

nene avatar Sep 06 '22 10:09 nene