ondras / rot.js

ROguelike Toolkit in JavaScript. Cool dungeon-related stuff, interactive manual, documentation, tests!
https://ondras.github.io/rot.js/hp/
BSD 3-Clause "New" or "Revised" License
2.33k stars 254 forks source link

Issues when using form unpkg.com #141

Open jcubic opened 5 years ago

jcubic commented 5 years ago

I've tried to use this file https://unpkg.com/rot-js/lib/rot.js (the only file) because rawgit will stop working and it give me errors, first global is not defined then exports and now after adding:

<script>
    var global = window;
    var exports;
</script>

it give me error Cannot set property 'isSupported' of undefined

because it try to execute:

/**
 * Export to Node.js module
 */
for (var p in ROT) {
    exports[p] = ROT[p];
}

event that exports is undefined. The fix is to use:

<script>
    var global = window;
    var exports = false;
</script>

which i thing is stupid (false is boxed with object so you can set props on it but in UMD check it's not object). Here is my codepen where I wanted to use rot.js

ondras commented 5 years ago

Well, the npm rot.js package is currently meant for server-side (nodejs) usage only.

Stay tuned, as a TS-rewrite project is under development and I hope that the modernized version would offer npm packages both for the server and client side.

jcubic commented 5 years ago

Great and thanks for this awesome project.

ondras commented 5 years ago

@jcubic Please try again with a new version: https://unpkg.com/rot-js@2.0.0/dist/rot.js