-
Notifications
You must be signed in to change notification settings - Fork 920
Description
Whenever there is an error parsing a jsx file, the server will throw an exception and return a yellow screen (standard error page) with some information about the parse error. Unfortunately, the error page seems to reference line and column numbers referencing the .js file that would have been produced, including the standard 5-line header, rather than the jsx source file.
The 5-line header included at the top of a compiled jsx file looks like:
// @hash v2-3CD45365F295AFAAAAC483D5FEFB3B72
// Automatically generated by ReactJS.NET. Do not edit, your changes will be overridden.
// Version: 1.5.0 (build 90661fe)
// Generated at: 4/24/2015 2:59:12 PM
///////////////////////////////////////////////////////////////////////////////
This header pushes any errors to different line numbers. For instance, in the following jsx snippet, the error is the missing comma on line 4 which leads to an unexpected identifier on line 5 columns 3.
var parseError = React.createClass({
render: function(){
return (<p>{this.state.message}</p>);
}
getInitialState: function(){
return {message: "Parse Error!"};
}
});
However, when trying to view the compiled result in the browser, the server returns the following error:
Error: Parse Error: Line 10: Unexpected identifier (at line 10 column 3) at ReactNET_transform_sourcemap (Script Document:113:9) -> throw new Error(ex.message + " (at line " + ex.lineNumber + " column " + ex.
The error is right, the location is just 5 lines off.