Yui Compressor issues with reserved words in JavaScript

For the life of me, I could not figure out why I was getting an error while running the Yui compressor on a set of my JavaScript files.

The error was very generic and not helpful

error : Failed to read in the data for the path/file [..\<path>\<filename>]. The most common cause for this is because the path is incorrect or the file name is incorrect … so please check your path and file names. Until you fix this up, I can’t continue … sowwy.

The file was present and seemed to be syntactically correct and all.

Finally, thanks to a little squiggly placed by Resharper (which is awesome!!), I found the issue. One of the js functions was called “goto” and that, apparently is reserved by JavaScript for “future use”, and Yui bombs on it.

Renaming it fixed the issue.


To be clear, the YUI compressor is behaving as it was designed to. Reserved words should not be used in JavaScript, as in other languages. However, I will say that the error dumped out when the compressor runs into a reserved word could be better.

About these ads

About floatingfrisbee

A programmer/blogger from New York City
This entry was posted in development tools, JavaScript, software development and tagged . Bookmark the permalink.

3 Responses to Yui Compressor issues with reserved words in JavaScript

  1. IlyasGu says:

    You cannot use long as local variable. This is also reserved.

  2. David says:

    Thanks for this post! You helped us debug a build issue in Idea Screening 2.0 =)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s