SteveSanderson / knockout-es5

Knockout.js meets ECMAScript 5 properties
158 stars 39 forks source link

Using with browserify #31

Closed hugozap closed 9 years ago

hugozap commented 9 years ago

Hi, i tried to use the plugin with browserify (with npm install knockout-es5 ) . But ran into issues with weakmap and ko dependencies. I did some small changes to make it work with browserify in case someone needs it:

https://gist.github.com/hugozap/1fdbd93094809cc7c691

archangel-irk commented 9 years ago

Thank you very much. On the days I will look in detail.

hugozap commented 9 years ago

The problem i found was with the way it detects commonjs and the fact that browserify does not support conditional requires. I had to move the requires to the top, and instead of including WeakMap, just include a require("weakmap") ( This breaks AMD support )

This is a temp fix ( works only with commonjs ) and requires knockout and weakmap dependencies, i think that an optimal solution would be to publish a browserify ready package to npm so it would be easy just to require("knockout-es5-browserify"), i can help if needed.

archangel-irk commented 9 years ago

Thanks for the explanation. If you are not difficult, you can make a Pull Request with the changes, and I'll accept. Thank you.

archangel-irk commented 9 years ago

Hi, I'm back. Tell us please what you want using knockout-es5 and browserify.

Please write an example of what you want and what you get with the original knockout-es5. Maybe I can solve your problem or suggest how it can be solved.