← Back to team overview

launchpad-dev team mailing list archive

Re: Javascript impossible to debug

 

On Mon, Feb 14, 2011 at 10:42 AM, Maris Fogels
<maris.fogels@xxxxxxxxxxxxx> wrote:
> On 11-01-31 11:18 AM, Deryck Hodge wrote:
>>
>> On Sun, Jan 30, 2011 at 8:23 PM, Tim Penhey<tim.penhey@xxxxxxxxxxxxx>
>>  wrote:
>>>
>>> Hi Team,
>>>
>>> Right now the default behaviour of our build system is to produce
>>> javascript
>>> that is impossible to debug as it minifies everything.
>>>
>>> How can we fix this?
>>>
>>
>> Long term the right solution is to get a combo loader going, one that
>> can be run locally in addition to the central Canonical one.  The
>> local one could then link non-minified files.
>>
>> Until then, it's probably worth making the jsbuild step sniff for
>> devmode and not link the minified files.  So launchpap.js would be
>> larger, but you could step through the code better.  I'm not sure what
>> the performance impact on development would be of this approach.
>>
>
> You may want to try linking the raw unminified files when building
> Launchpad's scripts.  At least the source will be readable.
>
> Untested, but should work:
>
>  $ make clean_js
>  $ make jsbuild JSFLAGS='--filetype=raw'
>
>
> This passes a command-line argument into the lazr-js JavaScript build script
> that changes the input files it selects.
>
> You can find the list of bin/jsbuild arguments by running 'bin/jsbuild
> --help' or by checking the sources under
> eggs/lazr_js-1.5DEV_r191-py2.6.egg/lazr/jslazr/js/build.py.
>

This is a great tip, Maris.  I didn't know about this either.

It doesn't work for YUI deps, but it does work for our own lp js code.
 The YUI deps are hardcoded now since we dropped devmode, but this
could be made to work for that trivially, I think.

Thanks for sharing! :-)

Cheers,
deryck


-- 
Deryck Hodge
https://launchpad.net/~deryck
http://www.devurandom.org/



References