Skip to content
This repository has been archived by the owner on May 25, 2018. It is now read-only.

'use strict' in faye.js causes problems on production #48

Open
ghost opened this issue Jul 10, 2013 · 8 comments
Open

'use strict' in faye.js causes problems on production #48

ghost opened this issue Jul 10, 2013 · 8 comments

Comments

@ghost
Copy link

ghost commented Jul 10, 2013

faye.js and other related files should be enclosed in (function(){ })(); blocks to avoid leaking this definition into other scripts when sprockets concatenates the files.

@jimsynz
Copy link
Owner

jimsynz commented Jul 10, 2013

Doesn't Sprockets do this automatically?

@ghost
Copy link
Author

ghost commented Jul 11, 2013

It seems to be doing it for everything but faye.js, so, either sprockets is trolling me or it's assuming that it's already done for builtin libraries.

@jimsynz
Copy link
Owner

jimsynz commented Jul 11, 2013

It's not just you :(

curl -s http://localhost:3000/assets/faye.js | head -1 | cut -c 1-100
'use strict';var Faye={VERSION:'0.8.9',BAYEUX_VERSION:'1.0',ID_LENGTH:160,JSONP_CALLBACK:'jsonpcallb

@jimsynz
Copy link
Owner

jimsynz commented Jul 11, 2013

Can you try using version 1.0.10 and get back to me?

@ghost
Copy link
Author

ghost commented Jul 11, 2013

It still seems to be broken for me, but I'm going to play around with it and make sure that it's not a problem on my side. The file is wrapped in the closure, so, it should work.

@ghost
Copy link
Author

ghost commented Jul 11, 2013

Okay, so, update: for whatever reason, faye-rails 1.0.10 breaks everything, but I've separated faye from the assets and loaded version 1.0.8 separately and it works (this doesn't work for v1.0.10).

So, this is still broken, but for now, this should at least be posted as a workaround.

@jimsynz
Copy link
Owner

jimsynz commented Jul 11, 2013

Okay, I've updated the closure to pass in this in e859e56. How did that go?

@jimsynz jimsynz reopened this Jul 11, 2013
@ghost
Copy link
Author

ghost commented Jul 12, 2013

I still seem to be getting a TypeError: this is undefined. Although, I'm having trouble determining where the this is because the source map is missing. I think that it's in Faye.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant