Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V2 : Multifile examples loaded from the example menu do not work #674

Closed
SimonClark opened this issue Sep 4, 2020 · 3 comments
Closed
Labels

Comments

@SimonClark
Copy link
Contributor

Expected Behavior

If there is a multi-file example in the examples menu, it should load

Actual Behavior

It does not load

Steps to Reproduce the Problem

Click on the STL Import example in the examples menu

Specifications

  • Version: 2.0.0
  • Platform: all
  • Environment: browser
@z3dev
Copy link
Member

z3dev commented Oct 1, 2020

I don't think this can be fixed. Here's why...

A project is a hiearchy of related files. From the examples...

module-design/
    index.js
    mountPlate.js
    package.json
    subFolder/
        sphereShape.js

The design uses 'relative' require statements to access the pieces.

const mountPlate = require('./mountPlate.js')
const sphereShape = require('./subFolder/sphereShape')

Unlike drag-n-drop, the actual file system structure is unknown (unavailable). So, somehow, a file system needs to be created. There might be several solutions:

  1. load the file system from the server. this is only possible by configuring the HTTP server, and totally insecure.
  2. load the 'required' files from the server. this would require parsing the code to determin the relative paths, loading, etc.

Number 1 really isn't feasible. configuring HTTP servers to expose file systems is almost 'forbidden', and this functionality is always a special extension.

Number 2 isn't possible. pre-parsing code is not realistic. even if possible, further functionality is required to assemble the file system, and load the contents from the HTTP server.

The solution is... 'drag-n-drop a project' or 'load a project'.

@z3dev
Copy link
Member

z3dev commented Oct 1, 2020

V1... yeah. it supported 'include()'. this was pretty much a hack, which scanned the scripts and replaced the 'include()' statements with call to a function lookup. very ugly and very limited. also, there was a relative URL being composed / decomposed to obtain the 'relative' URL of the included file.

@z3dev
Copy link
Member

z3dev commented Oct 17, 2021

Closing, as these 'project' based examples have been removed from the list of examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants