OpenJSCAD.org
OpenJSCAD.org copied to clipboard
V3: does not start the web UI
Expected Behavior
git clone [email protected]:jbroll/OpenJSCAD.org.git cd OpenJSCAD.org git checkout V3 pnpm install pnpm test cd pacakges/web pnpm run dev ... <Runs the local hosted web UI>
Actual Behavior
ParseError: 'import' and 'export' may appear only with 'sourceType: module'
Steps to Reproduce the Problem
above?
Specifications
- Version: V3
- Platform: mac
- Environment: local
@jbroll welcome
yeah. The web Ui is still work in progress, as some of the dependencies cannot be used with standard import/export.
will post back when something is working again
I made an attempt to make this work by converting the build commands in the remaining packages to rollup, but I could not get the code to be recognized as modules. Ideas about what direction might work for this?
Thanks for trying. The problem is webworkify. The internals accumulate code into a single JS block, which gets injected into the webworked. (For those weak in health, avoid looking at the code.)
The trick will be creating a webworker which loads the required packages using imports. I think @hrgdavor might have this functionality in the new prototype, which he has been working on for the last year.
@z3dev yes I have a worker that now can work with folder projects and load imports from unpkg/jsdelivr and node workspaces. There are few bits to test and tune, but it works well and I use it frequently to run my jscad scripts. It also handles TypeScript and ESM modules by converting them on the fly to csj/require.
Anyway, I hate those automatic/automagic worker code generators. That is why I am making the worker as standalone package. When creating a page you need to put it proper location and call it.
I finally have different bits ready for people to produce their own websites. Example here a standalone web page that has jscad with worker.
- demo: https://3d.hrg.hr/tmp/darvin/
- source: https://github.com/hrgdavor/jscadui/tree/main/apps/model-page
included in that demo is also my camera gizmo https://github.com/hrgdavor/jscadui/tree/main/packages/html-gizmo that I am very proud of.