danmarshall / jscad-now

🧱👀 Instantly view a jscad V2 module while coding
MIT License
22 stars 6 forks source link

Not working in Windows #14

Closed Digicrat closed 2 years ago

Digicrat commented 2 years ago

Under WSL with Node.js v17, I get the following in both the browser and shell. The file in question exists (it's a copy of a jscad example from https://www.openjscad.xyz/ ?->"Building a Dodecahedron") and can even be accessed from the opened server page.

Can't walk dependency graph: Cannot find module 'test_jscad.js' from '/home/david/test/jscad-now.js'
    required by /home/david/test/jscad-now.js

Under Windows 10 directly via Powershell in Node v16 I get no errors in the shell, a blank page in the browser, and an exception in the browser javascript console

parameterControls.js:19 Uncaught TypeError: Cannot read properties of null (reading 'map')
    at createParamControls (jscad-now.js:39537:41)
    at designParameters (jscad-now.js:39488:24)
    at module.exports (jscad-now.js:39341:45)
    at module.exports (jscad-now.js:39325:3)
    at Object.606../test1.jscad (jscad-now.js:39934:1)
    at o (jscad-now.js:1:265)
    at r (jscad-now.js:1:431)
    at jscad-now.js:1:460

Also, fyi, npm is reporting 5 'high severity vulnerabilities'.

danmarshall commented 2 years ago

My first instinct is that this must be happening somewhere in the Budo library layer / or its dependencies. Probably also related to the vulnerabilities, as it does not seem to be maintained.

danmarshall commented 2 years ago

We can probably switch to webpack. I only chose Budo since it was already part of the regl-renderer 's dev script. THis project is just a quick takeoff from that. https://github.com/jscad/OpenJSCAD.org/blob/b4d808a34fccd3fc72a327921dfd9fa997de9d99/packages/utils/regl-renderer/package.json#L11

hjfreyer commented 2 years ago

Is there any workaround for this, or is it just busted? I'm having the same problem on Debian.

danmarshall commented 2 years ago

Do your models provide parameter definitions? The previous code was expecting it:

const main = ()=> cube();

function getParameterDefinitions() {
    return [];
}
module.exports = { main, getParameterDefinitions }

I've just fixed this in 1.2.2, getParameterDefinitions is no longer required. Hopefully this fixes the issue.