donalffons / opencascade.js-examples

example repository for opencascade.js

Home Page:https://ocjs.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Errors in

borioan opened this issue · comments

Hello!
I try to test you example exactly how it is in this example (the same file structure) and generate the following errors message:

PS D:\OpenCascade.js_teste\00> npm start

00@1.0.0 start
webpack serve

i 「wds」: Project is running at http://localhost:9000/
i 「wds」: webpack output is served from undefined
i 「wds」: Content not from webpack is served from D:\OpenCascade.js_teste\00\src
i 「wdm」: wait until bundle finished: /
× 「wdm」: assets by status 65.5 MiB [cached] 5 assets
orphan modules 1.51 MiB [orphan] 9 modules
runtime modules 1.26 KiB 9 modules
modules by path ./node_modules/ 330 KiB
  modules by path ./node_modules/webpack-dev-server/client/ 20.9 KiB 10 modules
  modules by path ./node_modules/html-entities/lib/*.js 58.1 KiB 4 modules
  modules by path ./node_modules/webpack/hot/ 1.58 KiB 3 modules
  modules by path ./node_modules/url/ 37.4 KiB 3 modules
  modules by path ./node_modules/querystring/*.js 4.51 KiB
    ./node_modules/querystring/index.js 127 bytes [built] [code generated]
    ./node_modules/querystring/decode.js 2.34 KiB [built] [code generated]
    ./node_modules/querystring/encode.js 2.04 KiB [built] [code generated]
modules by path ./src/demos/ 4.51 MiB
  ./src/demos/bottle - basic/index.js + 7 modules 1.5 MiB [built] [code generated]
  ./src/demos/bottle - visualize/index.js + 8 modules 1.51 MiB [built] [code generated]
  ./src/demos/polygon/index.js + 8 modules 1.5 MiB [built] [code generated]

WARNING in ./node_modules/opencascade.js/dist/opencascade.wasm.js 11:59916-59933
Module not found: Error: Can't resolve 'crypto' in 'D:\OpenCascade.js_teste\00\node_modules\opencascade.js\dist'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
        - install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "crypto": false }
 @ ./node_modules/opencascade.js/index.js 1:0-53 5:13-24
 @ ./src/demos/bottle - visualize/index.js 8:0-49 30:0-15

ERROR in ./node_modules/opencascade.js/dist/opencascade.wasm.js 11:1147-1170
Module not found: Error: Can't resolve 'path' in 'D:\OpenCascade.js_teste\00\node_modules\opencascade.js\dist'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
        - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "path": false }
 @ ./node_modules/opencascade.js/index.js 1:0-53 5:13-24
 @ ./src/demos/bottle - visualize/index.js 8:0-49 30:0-15

ERROR in ./node_modules/opencascade.js/dist/opencascade.wasm.js 11:1288-1301
Module not found: Error: Can't resolve 'fs' in 'D:\OpenCascade.js_teste\00\node_modules\opencascade.js\dist'
 @ ./node_modules/opencascade.js/index.js 1:0-53 5:13-24
 @ ./src/demos/bottle - visualize/index.js 8:0-49 30:0-15

webpack 5.10.3 compiled with 2 errors and 1 warning in 9041 ms
i 「wdm」: Failed to compile.

As you can see from above , it seems that

"scripts": {
    "start": "webpack-dev-server",
...
} 

is not actual anymore, I must use webpack serve as below:

"scripts": {
    "start": "webpack serve",
..
}

It is possible to update the examples with the latest updated npm packages?
Also, loading your live example posted here, with the last version of Microsoft Edge, I can not import a STEP file - no 3d part is loading. Any help is welcome!!
Thank you very much!

Hi,

thanks for your bug reports!

Regarding the outdated webpack configuration: I'll put it on my list. If you have a fixed version ready and working, a pull request would be much appreciated. Otherwise, I will look into the issue over the holidays.

Regarding the STEP file issue: This is a weird one! I tested this, too and with the current version (1.1.1) of OpenCascade.js some STEP-files work, some don't. With the previous major version of OpenCascade.js (0.1.19) (which is used in CascadeStudio), all my test STEP files work. The error comes from within the OpenCascade library, which responds with an error code when reading the problematic step files.

I'm currently working on a new version of OpenCascade.JS and have written down some ideas about it here. One of the main issues with the current version is, that compilation times are insanely long (about 8h on my fairly modern dev machine). This (and the fact that WASM debugging tools are really just starting to become useful - at least in my experience) make it extremely painful to debug issues like the STEP file issue you mentioned. So, for the moment, I would recommend to wait for the new release. There are several Emscripten-related problems that are currently blocking the new version. However, the support from the Emscripten team has been great and I'm confident that the remaining issues can be resolved, soon.

Also: This project needs more tests 🙂.

Hi!
I'm very early in using web application development technologies, so before I can make any improvements I have to learn a lot!
The starting point in my project was exactly CascadeStudio, where I got to its source - OpenCascade.js. I was also surprised to find that CascadeStudio imports STP / STEP files much more correctly than OpenCascade.js, now the reason is clear!
Regarding the new version, I consider that the new module splitting approach is an excellent one along with porting to the latest version of OpenCascade!!
For my project I just need to display some STEP files in the browser, so a simplified version of using the new OpenCascade.JS would have helped me a lot, somewhat similar in approach in StudioCascade in which no webpacks are used. Maybe you can consider this idea an create a new separated updated OpenCascade.JS examples without webpack!
I would definitely like to get involved in testing new versions of OpenCascade.JS!
Thank you for your effort and time involved in this project!

Thanks for your suggestions. Let's keep this open to track those issues.

Sure! :-)

The issue of not being able to load certain STEP files has been fixed. The related issue is here.