xyz-tools / gcode-preview

A simple GCode parser & previewer lib with 3D printing in mind. Written in Typescript.
https://gcode-preview.web.app/
MIT License
160 stars 31 forks source link

Module imports for demo #158

Closed sophiedeziel closed 5 months ago

sophiedeziel commented 5 months ago

Closes https://github.com/remcoder/gcode-preview/issues/97

I tried updating to three.js v165 but the render of the lines did not work properly. So that will need to be fixed separately.

stackblitz[bot] commented 5 months ago

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

github-actions[bot] commented 5 months ago

Visit the preview URL for this PR (updated for commit 62e7799):

https://gcode-preview--pr158-feature-demo-on-modu-wq88m6dq.web.app

(expires Mon, 10 Jun 2024 23:09:41 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 59bd114ae4847b32c2bba0b68620b9069a3e3531

remcoder commented 5 months ago

awesome!

could the import map be changed into a single line with a script tag and type=module? Would that still work?

sophiedeziel commented 5 months ago

could the import map be changed into a single line with a script tag and type=module? Would that still work?

I can try to make it shorter, maybe by splitting in it's own file. But my understanding is that the importmap type is a specific type and I'm not sure how to make this work with a type=module instead.

sophiedeziel commented 5 months ago

I tried

<script type="importmap" src="importmaps.json"> </script>

and got

Screenshot 2024-06-03 at 17 21 54

I dug deeper and found: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap

Screenshot 2024-06-03 at 17 27 11