Skip to content
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

SyntaxError: invalid regexp group #172

Closed
NavidMitchell opened this issue Feb 19, 2020 · 8 comments
Closed

SyntaxError: invalid regexp group #172

NavidMitchell opened this issue Feb 19, 2020 · 8 comments

Comments

@NavidMitchell
Copy link

This may be completely unrelated to your project. I have tried to include your library into my project which is a vue.js app built with vue cli and using typscript. After importing your library when I launch my project I just get the following error in my console.

SyntaxError: invalid regexp group chunk-vendors.js:1:7

If I remove the usage of the ow library it goes away. Any help would be appreciated. I have never encountered this sort of error before.

Thank you,
Navid

@neptunelabs
Copy link

neptunelabs commented Mar 6, 2020

I'm experiencing the same error after updating ow to version 0.16.0 in my project.

0.16.0 and 0.17.0 work fine in Google Chrome, but not in Firefox (error:"SyntaxError: invalid regexp group") nor in Edge (error: "Expected identifier, string or number").

0.15.1 is the last version running without syntax errors in my project with all browsers.

Regretfully I can't tell exactly where the error occurs in ow, as I use a ow in a webpack'ed script in my project.

Target of my project is es2017.

Cheers,
Hanno

@sindresorhus
Copy link
Owner

The only place we use a regex not supported by Firefox is:

const labelRegex = /^.*?\((?<label>.*?)[,)]/;

But that file is excluded for browser use:

ow/package.json

Lines 80 to 82 in b2285d0

"browser": {
"./dist/source/utils/infer-label.js": "./dist/source/utils/infer-label.browser.js"
},

Which makes it sound like Vue CLI doesn't respect the browser field. If that's the case, you should open an issue on Vue CLI.

@neptunelabs
Copy link

Thanks for the reply!
I don't use Vue CLI, but webpack CLI (version 3.3.11).
So it looks like webpack doesn't support the conditionals in the "browser" section of your package.json either.

@jorcalle11

This comment has been minimized.

@jorcalle11

This comment has been minimized.

@sindresorhus
Copy link
Owner

So it looks like webpack doesn't support the conditionals in the "browser" section of your package.json either.

That would be surprising as Webpack popularized the browser field. I would open an issue on Webpack about this.

@nullfame
Copy link

@neptunelabs, did you ever file this elsewhere?

Also experiencing this issue with Vue CLI 4.3.1 (2020-04-07). Would gladly contribute a fix. The pragmatic side of me says changing this one line in this one package is the easiest. Replacing ow in my repos is next easiest. Getting Babel or Vue to change is the least likely to resolve in the near-term.

@neptunelabs
Copy link

@nullfame: I didn't file this anywhere else except here.
As you can see here @sindresorhus suspects the problem in Webpack and Vue not supporting conditionals in the "browser" section of the package.json properly.
I didn't dig deeper into this yet and stick with version 0.15.1 for now.

vladfrangu pushed a commit to vladfrangu/ow that referenced this issue Jan 7, 2021
vladfrangu pushed a commit to vladfrangu/ow that referenced this issue Jan 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants