mbraak / jqTree

Tree widget for jQuery
https://mbraak.github.io/jqTree/
Apache License 2.0
1.02k stars 177 forks source link

Minified tree.jquery.js cause errors on firebug #360

Closed sveetch closed 9 years ago

sveetch commented 9 years ago

In my webapp, i'm using your library within a "bundle" that assemble javascript files in a unique file that is minified using YUIcompressor.

This works well appart that i've got errors from firebug:

Error: Cannot find module 'undefined'

...turn h(k,!0)}if(a){return a(k,!0)}throw new Error("Cannot find module '"+k+"'")}...

That is throwned from the minified file when it's loaded. Apparently it does not break anything, i just got this error in the console everytime i load the minified file.

I thinks thats coming from these code lines like the first ones that seems minified and YUIcompressor have troubles with allready minified code.

Do you know a solution about this ?

mbraak commented 9 years ago

Unfortunately I cannot not reproduce this error. I used yuicompressor 2.4.8 and the latest dev branch of jqtree.

By the way, the cannot find module text is from browserify.

sveetch commented 9 years ago

Thanks for your reply, i will take some times this weekend to investigate this and let you know

sveetch commented 9 years ago

I'm also using yuicompressor 2.4.8 but in fact it not related to yuicompressor, without minification the error message still showing in the firebug console with Firefox 36.0 and Chromium 40.0. And independently (not merged with other js files) the error don't occur.

BUT if i just add a ; to the very end of tree.jquery.js, just here https://github.com/mbraak/jqTree/blob/master/tree.jquery.js#L3388 , resolve the problem, the error does not occurs anymore either with or without minification.

sveetch commented 9 years ago

I did a gist with the original tree.jquery.js version then append change with the ; here :

https://gist.github.com/sveetch/e32576d1d4d3dde3ac20/revisions

So you can clearly see my little "fix"

mbraak commented 9 years ago

Thanks for finding this! I will add a semicolon to tree.jquery.js

mbraak commented 9 years ago

This is now fixed in the dev branch.