prismarine-viewer icon indicating copy to clipboard operation
prismarine-viewer copied to clipboard

Broken JSPYBridge support

Open SilkePilon opened this issue 1 year ago • 5 comments

when using require("prismarine-viewer") i get this error:

require() of ES Module /home/silke/.pyenv/versions/3.11.6/lib/python3.11/site-packages/javascript/js/node_modules/@tweenjs/tween.js/dist/tween.cjs.js from /home/silke/.pyenv/versions/3.11.6/lib/python3.11/site-packages/javascript/js/node_modules/prismarine-viewer/viewer/lib/viewer.js not supported.\ntween.cjs.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.\nInstead rename tween.cjs.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /home/silke/.pyenv/versions/3.11.6/lib/python3.11/site-packages/javascript/js/node_modules/@tweenjs/tween.js/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).\n\n at Object.<anonymous> (/home/silke/.pyenv/versions/3.11.6/lib/python3.11/site-packages/javascript/js/node_modules/prismarine-viewer/viewer/lib/viewer.js:2:15)\n at Object.<anonymous> (/home/silke/.pyenv/versions/3.11.6/lib/python3.11/site-packages/javascript/js/node_modules/prismarine-viewer/viewer/index.js:2:11)\n at Object.<anonymous> (/home/silke/.pyenv/versions/3.11.6/lib/python3.11/site-packages/javascript/js/node_modules/prismarine-viewer/lib/mineflayer.js:2:23)\n at Object.<anonymous> (/home/silke/.pyenv/versions/3.11.6/lib/python3.11/site-packages/javascript/js/node_modules/prismarine-viewer/index.js:2:15)')

SilkePilon avatar Dec 19 '23 18:12 SilkePilon

maybe this is a bug with jspybridge but idk

SilkePilon avatar Dec 19 '23 18:12 SilkePilon

tested it and it workes fine in npm version 1.25.0 and below. 1.19 & 1.20 support broke it ig

SilkePilon avatar Dec 19 '23 18:12 SilkePilon

What prismarine-viewer version?

rom1504 avatar Dec 19 '23 19:12 rom1504

What prismarine-viewer version?

so version 1.25.0 for the viewer works but anything above that fails. Not only on my pc everyone that uses lodestone also gets this error. i fixed it by setting the version back to 1.25.0 in the python import.

SilkePilon avatar Dec 19 '23 19:12 SilkePilon

https://github.com/PrismarineJS/prismarine-viewer/pull/381 probably need to roll back this

rom1504 avatar Dec 19 '23 20:12 rom1504