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

Random "Unexpected token ILLEGAL" error #43

Open
chrisjaure opened this issue Apr 9, 2015 · 4 comments
Open

Random "Unexpected token ILLEGAL" error #43

chrisjaure opened this issue Apr 9, 2015 · 4 comments

Comments

@chrisjaure
Copy link

I'm having some trouble pinpointing the exact cause of this error, but I've got 4 bundles and only the one with readFileSync calls fails randomly with this error. In that bundle, there are 7 readFileSync calls in succession. I added some logging and it seems that when this error triggers, the source is mangled and the readFileSync calls are resolved out of order. It only happens once out of 20 or so times.

I'd be happy to debug further, but I'm not sure where to look next or what information you might need.

@chrisjaure
Copy link
Author

As an example, I added logging in the brfs readFileSync fn for when the stream starts and when it ends. Here is what it looks when everything is fine:

start a
start b
start c
start d
start e
start f
start g
end a
end b
end c
end d
end e
end f
end g

And here's a case where it failed (notice b ends before a and f ends before e):

start a
start b
start c
start d
start e
start f
start g
end b
end a
end c
end d
end f
end e
end g

@chrisjaure
Copy link
Author

I should also mention that I didn't see this issue in browserify 3.x but only after I upgraded to 9.x so this may actually be a browserify bug.

@chrisjaure
Copy link
Author

Did some more testing, not sure the order of stream completion matters. Might have just been a coincidence.

However, if I return a string from readFileSync like in #28 (comment) then it works just fine. So it is some sort of stream issue.

@Hafthor
Copy link

Hafthor commented Apr 14, 2015

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

2 participants