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

Could not load ShapePath imported by node_modules textRenderer.js #77

Open
MiguelG97 opened this issue Jul 17, 2023 · 6 comments
Open

Comments

@MiguelG97
Copy link

Dear developer,

I'm struggling with bundling the project. I've installed the libraries and somehow the node_modules is having problems to import files form three js library.
Would you mind helping me with this one, here is the repo. Literally no code, just setting up the rollup bundle:

https://github.com/MiguelG97/dxfViewer

image

All the best
Miguel G

@vagran
Copy link
Owner

vagran commented Jul 17, 2023

Hi,
Actually I am not familiar with rollup and never tried to use it with this library. From the first look, it seems that it cannot resolve that imports without .js extensions. Probably the extensions should be added in TextRenderer.js:

import {ShapePath} from "three/src/extras/core/ShapePath.js"
import {ShapeUtils} from "three/src/extras/ShapeUtils.js"

I will fix it in the mainline, you can now fix it locally as a workaround.

vagran added a commit that referenced this issue Jul 17, 2023
@MiguelG97
Copy link
Author

MiguelG97 commented Jul 19, 2023

Dear vagran, The issue persist somehow

image

image

By the way, does dxf-viewer provides a measurement tool? if that's not the case, would you mind pointing to me to some topics, approaches or documentation that can help me to build a measurement tool?

Best regards,
Miguel G.

@vagran
Copy link
Owner

vagran commented Jul 19, 2023

The fix is in master branch, not yet released in npm (there still other problems most probably will occur). You can use it directly by specifying this in your package.json:

"dxf-viewer": "github:vagran/dxf-viewer#master"

By the way, does dxf-viewer provides a measurement tool?

No, the library is just a renderer. Any tools are a subject for implementation in applications built on top of the library. For measuring distance between two points you can use some spatial 2D index for indexing all vertices received in rendering batches, then use it to lookup nearest vertex to snap to. However, currently all information about vertex semantic is lost, so it is not possible to filter out, e.g. vertices of text glyphs or tesselated arcs.

@MiguelG97
Copy link
Author

MiguelG97 commented Jul 25, 2023

Dear @vagran
I fix up the import reference issue and in addition I included the "export default" on the node_modules\loglevel\lib\loglevel.js file since rollup was asking for it:
https://rollupjs.org/troubleshooting/#error-name-is-not-exported-by-module

However, now I'm facing the following issue:
image
any ideas on how to fix it up?

here is the repo:
https://github.com/MiguelG97/dxfViewer

Best regards,
Miguel G

@vagran
Copy link
Owner

vagran commented Jul 25, 2023

However, now I'm facing the following issue: image any ideas on how to fix it up?

Best regards, Miguel G

It is difficult to say where the problem is without any reference to the original sources. Try to build with source maps generation enabled, so it will hopefully provide reference to a place in the original sources.

@MiguelG97
Copy link
Author

MiguelG97 commented Jul 25, 2023

Here is the link to the original repo: https://github.com/MiguelG97/dxfViewer

image

Something going on at line 30850 apparently

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

No branches or pull requests

2 participants