1

I created a new project in Dart Editor with the template that prints "Your Dart app is running." to the page and compiled it to js. I put it to my localhost wamp server and it works fine.

However, when I deploy and upload this dart web app to my web server, it doesn't even enter the main() method and errors out with the following

Uncaught ReferenceError: Invalid left-hand side in assignment

Compiled with debug mode enabled, the source maps allow me to see which line causes this, but it appears to be pointing at line 8 which is the closing bracket for the main method.

What the hell is happening here? Why would this compiled dart run fine on my own local web server but completely breaks when hosted on my website? This has been puzzling me for the past few hours and has stopped me from deploying my real application.

Here is a link for a live example of the issue http://pokesharp.com/error/

Nicolas Martel
  • 1,641
  • 3
  • 19
  • 34

1 Answers1

1

The problem were line endings.

This is the original code, executed on my local machine

When uploading this file to my remote host and downloading it back, this is what I found

(With the comments further into the line, commenting out important code)

The problem lies within the line endings. Dart2JS seems to be mixing line endings and these characters were being dropped when uploading to my host with FileZilla. Setting the transfer type to binary will keep the endings and all is good.

The question however is why does Dart2JS mixes line endings? It seems to in CR and LF and certain places.

Nicolas Martel
  • 1,641
  • 3
  • 19
  • 34