danmarshall / jscad-now

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

Importing stl throws error #11

Open Logical-sh opened 3 years ago

Logical-sh commented 3 years ago

Trying to import an STL using require throws a parser error. I believe this means it is not trying to use the jscad importer, but instead import it as a js module. This project works perfectly fine when drug into the the jscad site for 2.0.

Rhinoceros Binary STL ( May  7 2019 )
           ^
ParseError: Unexpected token```
danmarshall commented 3 years ago

Hi @comwizz2, I guess I'm opinionated about the jscad importer. I should add this to the readme.

My belief is that it should just be plain Node.js and there is a lot of code in the importer that duplicates what already exists and is supported by a much larger community. Also, the importer would probably break the debugging capabilities of jscad-now since it uses a web worker in an opaque way.

Thank for filing the issue though. If there are others who feel strongly that this should be added perhaps there is a Browserify plugin that we can write to achieve this functionality.

Logical-sh commented 3 years ago

Well some instructions on importing non-js files would be useful otherwise I think. If this is loading in the browser can I even require the file api?

On Tue, May 18, 2021 at 4:23 PM Dan Marshall @.***> wrote:

Hi @comwizz2 https://github.com/comwizz2, I guess I'm opinionated about the jscad importer. I should add this to the readme.

My belief is that it should just be plain Node.js and there is a lot of code in the importer that duplicates what already exists and is supported by a much larger community. Also, the importer would probably break the debugging capabilities of jscad-now since it uses a web worker in an opaque way.

Thank for filing the issue though. If there are others who feel strongly that this should be added perhaps there is a Browserify plugin that we can write to achieve this functionality.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/danmarshall/jscad-now/issues/11#issuecomment-843573035, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMJ27V5J5KBWEGP5B6B23DTOLLFLANCNFSM443IZZPQ .

danmarshall commented 3 years ago

I think that you can just use the Node.js file api, and that Browserify will make it "just work" in the browser.