Closed RaulLazaro closed 3 years ago
@RaulLazaro May I ask what version you're using? I apologize for the example not working.
I started with version v1.1.1-beta.0 but today I am testing with the last one, v1.1.1
@RaulLazaro I believe the problem is with serving worker.js
. Can you verify if your dev server is serving it at http://localhost:4201/worker.js
(It should be a minified JS file)?
it is not being served. But I don't know how to configure it because the worker.js file is the one inside node_modules/cura_wasm/dist/es ?
@RaulLazaro Yes, it's located at node_modules\cura-wasm\dist\es\worker.js
. I'm afraid this might be a bug with /index.js
being hard-coded into cura-wasm
preventing all but the demo from working.
@RaulLazaro Could you post your webpack + dev-server configuration?
I'm using the default ones, I don't have much experience with webpack.
I simply run npx webpack
to bundle src/index.js
to dist/main.js
And then serve with npm script:
"scripts": {
"start": "webpack-dev-server"
}
@RaulLazaro Can you check if the worker.js is served under the dist
directory? (http://localhost:4201/dist/worker.js
)
[Edit]
After looking at your original post again, I just want to make sure you're aware that the demo uses nollup
(Rollup + dev server) to serve it, not wepback (Cura WASM should work with wepback but the demo was not designed to use it).
[Edit 2] Wepback should take care of package resolution but I'm not sure if threads.js (Used to offload slicing to a separate thread) plays nicely with the default dependency resolution. One potential hack is to require the worker in the Angular component? so it gets bundled with everything else.
[Edit 3] I have a working reproduction and can confirm that there's a problem with bundling and threads.
[Edit 4] This bug effects ALL installations using Webpack. A fix has been started.
[Edit 5] The fix can be tracked in the webpack-fix branch
[Edit 6] Currently working on developing a new Rollup plugin because rollup-plugin-bundle-imports isn't working on NodeJS (But it is working in the browser)
[Edit 7] The in-development plugin appears to be working! I've verified it works with both Angular (Webpack), Rollup, and NodeJS. Hoping for a release in the next 24 hours.
@RaulLazaro cura-wasm@1.2.1 is working for me with Angular.
I did notice a bug in your implementation: this.stl
was a reference to a File, not an ArrayBuffer. The fix is to call this.stl.arrayBuffer()
which returns a promise that resolves to an ArrayBuffer.
Please tell me if anything else does not work and thanks for filing this issue.
It works great!! Thanks for your time.
Hello,
I am trying to test this package as it looks very interesting but I am unable to get it to work.
First I tried a project with Angular, create a simple component very similar to your example.
But when clicking on slice I get this error.
In a second attempt, I copied your code from the demo folder and use webpack to bundle the js, but the same error occurred.
I don't know if any extra configuration is necessary, perhaps from webpack, or there is something wrong with the package.