JavaScript: Unexpected end of input ... because it only downloads part of the file?

Strange error here: I have a page linking to multiple JavaScript files. Sometimes the browser will complain about:

Uncaught SyntaxError: Unexpected end of input

However, this does not seem to be due to an absent parent or invalid JSON. Part of the JavaScript file will load, but the program will simply stop loading the rest of the file. Example: half of the file will be downloaded, and the other half will be missing.

In most cases, downloading files and everything works. Any idea why I sometimes get this error and not every time (as expected with an absent guy or something similar)? Other things I can check?


EDIT

  • This is a Rails project (Rails version 3.2).
  • JS files are standalone and are stored in the pub directory for dev. In other words, they are NOT included in the asset pipeline.
+4
source share
1 answer

There must be brackets that do not close properly. The file stops every time an error occurs and leaves the rest unloaded as if due to an error. Here you can check this

-1
source

Source: https://habr.com/ru/post/1544618/


All Articles