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

Unable to load version 0.63 (from npm) #124

Closed theotherhiveking closed 7 years ago

theotherhiveking commented 7 years ago

Hello.

I tried Rotjs with Webpack in a new project, but I think that the build on npm for version 0.63 is broken (version 0.62 works fine).

Loading a bundle with Rotjs in it in the browser results in this error:

Uncaught ReferenceError: ROT is not defined
    at Object.<anonymous> (bundle.js:5521)
    at Object.<anonymous> (bundle.js:5661)
    at __webpack_require__ (bundle.js:20)
    at Object.<anonymous> (bundle.js:72)
    at __webpack_require__ (bundle.js:20)
    at Object.defineProperty.value (bundle.js:63)
    at bundle.js:66

Line 5521 (bundle.txt): ROT.Display.Term = function(context) Which is the first line of node/term.js.

I had a look at the makefile, I think the problem is that 'umd/post.txt' isn't the last file added to the build file when using the node build.

Here is the file order defined in the makefile: rot.js.node: $(NODE_PRE_SOURCES) $(SOURCES) $(NODE_POST_SOURCES)

I think that once 'umd/post.txt' (the last file in $(SOURCES)) is added, the object "ROT" is no longer in scope for anything that comes after that. The files in $(NODE_POST_SOURCES) reference "ROT", so that results in the ReferenceError.

ondras commented 7 years ago

Hi @theotherhiveking,

thanks for this bugreport. I will try to have a look at it.

ondras commented 7 years ago

Hi @theotherhiveking,

please try updating to the NPM version 0.6.4 and trying again.

theotherhiveking commented 6 years ago

Just tried it. I can confirm it's working.