-
-
Notifications
You must be signed in to change notification settings - Fork 765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Require function is leaked to the global namespace since v2.0.3 #98
Comments
Sorry, I got out of the loop. @puzrin said we're not using browserify anymore. And forced me to delete my irrelevant comments :P |
@PaulTondeur , we don't support browser officially, that build is only for demo page and can contain some crap, that doesn't make sense for demo. As i see, browserification code is completely outdated. However, code is written to be browserifiable. Try to use |
Thanks for the quick replies @ixti and @puzrin. Too bad browserify is not used anymore. Till yesterday I never heard of browserify or webmake. Node is also still new to me. |
I don't know, who really needs to use yaml in browser. But if someone wish to care about browserified version & AMD - no problem, good patches will be accepted. Personally, i'd recommend to use Can we close this issue? |
@PaulTondeur as a temporary measure you can use the patch I was proposing: 134de73 |
I think the beauty of making a good and solid library is that it can be used in ways you never imagined. In my case this is because the project is a pilot project for porting a large flash project seamlessly over to HTML5. Sure a tool could be used to save the yaml files as a different format, but I also understand that it would be easy to use the exact same data-source. There might be many other reasons why one would like to use yaml on the frontend. So I would vote for caring about a browserified version. In this case js-yaml is installed by using bower. Sure I can apply the fix I proposed and was implemented by you @ixti, but it would be nice if it was correct at the source, as this completely breaks the bower setup. There will be ways around it, but its not that elegant to do so (read: make an exception for js-yaml and put a manually edited version into the GIT repo of the project and not use bower for it). To be honest I think it is too soon to close this issue. It is still an issue with js-yaml that it leaks the require method (in the browser ready version). In this thread we have discussed how it could be resolved. I would say that an issue could be closed if:
Neither is the case at this moment. |
I tend to agree with you @PaulTondeur.
Will try to provide a PR. |
Great to hear we tend to agree @ixti :-) A small addition to my previous comment is that this other Flash project we're talking about made use of yaml as its main datasource. I did not expressed that very clearly in the comment before. I'd really like to help out and do not intend for someone else to do it. But node and all of its tools is too new for me to be effective at it at the moment. It is highly appreciated that you've had a look into this already and see ways to get this addressed! |
Should be fixed in |
As of version v2.0.3 the require function is leaked to the global namespace.
When I look at the current compiled
js-yaml.js
, it has the following code on line 24:It is missing the var definition and thus leaking the variable to the window. It should instead be:
This is especially a problem when using together with requirejs, as it breaks many things. When changing this locally, it works as expected (with or without requirejs)
I've tried forking the project so I could send you a ready to use fix, but I'm not able to find where this went wrong between version
2.0.2
and2.0.3
. I suspect this is something that goes wrong in the build process.Fixing it might be achieved by putting the var in
40_before.js
, but I think there will be some other place this should be fixed.The text was updated successfully, but these errors were encountered: