SteveSanderson / knockout-es5

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

Not working via npm? #49

Open grofit opened 8 years ago

grofit commented 8 years ago

I could have sworn this was working last time I used it, but if you basically do:

var ko = require("knockout-es5");

It does not seem to expose the main methods, like track etc. Is this the correct way to use it in the commonjs world? (Let us not get onto the conversation as to why I am having to use knockout on the server side).

grofit commented 8 years ago

After some investigation it seems to be down to the weakmap shim, if I remove that it works fine in a node environment however I am not sure if there is a reason why it is setup like it is, almost all other knockout stuff do the UMD dance at the top before loading whereas this does not.

If anyone can give guidance I am more than happy to wrap it so it exports correctly, alternatively it may just be linked to:

https://github.com/SteveSanderson/knockout-es5/issues/41

I do not know who the owner is as its down as @greenjello but I cannot see any contributors who match that persons details.

https://www.npmjs.com/package/knockout-es5

grofit commented 8 years ago

After playing it seems if I basically put the dependency as the github repo rather than the npm module it works fine:

"knockout-es5": "SteveSanderson/knockout-es5"

So this can be used as a workaround (again I know it will be rare anyone uses knockout on the server side).

blazkovicz commented 8 years ago

I use knockout on client, but prefer npm and not bower modules if available.