Anonyfox / node-webkit-hipster-seed

Bootstrap a crossplatform Desktop Application using tools you probably never heard of.
Other
1.29k stars 83 forks source link

There doesn't seem to be any source maps for easily debugging CoffeeScript or compressed JavaScript #13

Open jamesmortensen opened 10 years ago

jamesmortensen commented 10 years ago

This looks really promising. However, I'm used to being able to debug code in my Chrome debugger. But with AngularJS and CoffeeScript, in order to do that, source maps are a critical component. Without source maps, I'd be like the guy in #5 who would rather stick to pure JavaScript. This isn't a "comfort-zone" thing, this is a "I'm a serious developer writing a lot of code and need to be able to debug stuff" kinda thing.

brunch is supposed to be able to create source maps, and from the help section and documentation on their site, it sounds like it's supposed to do this automatically. Is this a node-webkit-seed issue, an issue with brunch, or a CoffeeScript problem?

One thing I'll say in support of JavaScript is it just plain works. These fancy tools are nice and all, until they stop working...

jamesmortensen commented 10 years ago

Update:

By default, npm run compile appears to run brunch watch -P under the hood. -P builds the app for production without all of the map files.

So, I got rid of the -P. Now, there are source maps, and I can match console statements to line numbers in the CoffeeScript source, but the auto-reload feature breaks:

Error: Failed to execute 'connect' on 'WebSocket': the URL 'ws://:9485/' is invalid.
    at connect (file:///Users/jem/Dev/node-webkit-hipster-seed/MyApp/_public/js/vendor.js:36322:22)
    at eval (file:///Users/jem/Dev/node-webkit-hipster-seed/MyApp/_public/js/vendor.js:36336:3)
    at eval (file:///Users/jem/Dev/node-webkit-hipster-seed/MyApp/_public/js/vendor.js:36337:3)

It looks like the host variable is null in the auto-reload.js node module:

Uncaught SyntaxError: Failed to execute 'connect' on 'WebSocket': the URL 'ws://:9485/' is invalid. auto-reload.js:33
connect auto-reload.js:33
(anonymous function) auto-reload.js:47
(anonymous function)

Basically, the only way I've been able to get the map files working and the automatic compilation at the same time was by running this command:

:MyApp jem$ brunch watch -s -p 9485

There's errors preventing what I assume is the auto-reload. My guess is I'm not seeing that with the -P option because, for optimized production, auto-reload isn't used, but when I run the command to generate the map files, there's no WS server unless I start one, and the resulting error isn't enough to crash node-webkit like it would when there's no WS server running. Hope this helps!

Rameshv commented 10 years ago

Hi, Just disable the auto-reload-brunch dependency from the package.json (in root dir). Now you can run the brunch watch with dev mode without these problems.