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

Compiled with Syntax error - Invalid regular expression #5564

Closed
MatusSkerlik opened this issue Mar 29, 2017 · 14 comments
Closed

Compiled with Syntax error - Invalid regular expression #5564

MatusSkerlik opened this issue Mar 29, 2017 · 14 comments
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@MatusSkerlik
Copy link

MatusSkerlik commented Mar 29, 2017

When i run project in "developing" mode everything works as it should.
npm run dev
But when i bundle code into Electron and run application, i am getting error in /app/dist/bundle.js
npm run package

Syntax error: Invalid regular expression: missing /

my repository rep

Compilation of source code is made by babel-pollyfill
OSX 10.12.3, node v6.9.2, npm 4.2.0

@babel-bot
Copy link
Collaborator

Hey @MatusSkerlik! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.

@loganfsmyth
Copy link
Member

I think you'll need to narrow this down a bit, there isn't nearly enough information to go on. What code is failing? Do you have a sense for what the error is? What makes you say this is a Babel issue?

The link to your repo also doesn't work.

@MatusSkerlik
Copy link
Author

MatusSkerlik commented Mar 29, 2017

Sorry for that link, it works now.
Like i said everything works until i run bundled application.
I think it is problem with babel or my babel configuration because code is converted from es6 to es5 and that is babel functionality. I really dont know where is the problem, but when i use syntax validator to test file /app/dist/bundle.js (generated by babel-pollyfill) there is a syntax error.

@loganfsmyth
Copy link
Member

I'm happy to help if this is a Babel issue, but it would be great if you could narrow it down. That file is 2MB. What regex is broken? What does it look like in the original source? What change happened to make it break, at least from what you can tell?

@MatusSkerlik
Copy link
Author

MatusSkerlik commented Mar 29, 2017

it is on 12 line, it is loadash.js 1.8.3 section of code i think, please go to http://esprima.org/demo/validate.html and copy contents of bundle.js in it so you can see. When i fix this line another syntax error will show up on line 37, modernizr.js section, and it continues for ever. And only regex i use is in /app/components/ReserveGrid.js, but i tried to comment it, but with same results after compilation. Im sure that error is not in my code, but probably in configuration of webpack or babel ? I don't know really.

@loganfsmyth
Copy link
Member

Line 12 is 90000 characters long. Please include the working vs failing regexes here so we can compare.

@MatusSkerlik
Copy link
Author

This lines don't work.
generated code -> line 12 var W=//g;,
generated code -> line 36 Fe=//g, He=//g and so on.
I think that first slash is representing something like new line because everything is form end of line.
It is helpful in some way ?

@loganfsmyth
Copy link
Member

If you remove the BabiliPlugin from your Webpack config, does it work? It's possible that's causing some issue.

@MatusSkerlik
Copy link
Author

Yes, it works now. Thank you so much, you have saved my ass 👍

@loganfsmyth
Copy link
Member

Babili is still beta-level, so it's certainly possible there is some bug you are hitting here.

@MatusSkerlik
Copy link
Author

Thank you again, i would not use it if i knew it. It took my so much time.

@boopathi
Copy link
Member

@MatusSkerlik looks like some bug with Babili in regexp. Might be the same as babel/minify#440. Can you try with Babili Option - regexpConstructors set to false

new BabiliPlugin({
  regexpConstructors: false
})

in your webpack config.

@Nantris
Copy link

Nantris commented Apr 5, 2017

For me, the package Chrono-Node 1.3.1 and 1.2.5 both cause this error. Adding regexpConstructors: false makes no difference unfortunately.

@merges
Copy link

merges commented Apr 13, 2017

Ditto; this is an issue that chrono-node 1.3.1 raises for me with Babili.

@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label May 4, 2018
@lock lock bot locked as resolved and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

No branches or pull requests

6 participants