-
Notifications
You must be signed in to change notification settings - Fork 382
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
Issue with roslibjs and Webpack 5 #382
Comments
any updates? How do we fix this issue? |
I think the solution is in browserify/webworkify#43. Am I correct @amosbyon1224? |
That repo hasn't PR'd in four years. Is this the best solution? |
Webworkify is 80 lines. It should be trivial to just copy it into this repo with the suggested fix. |
Indeed, browserify/webworkify#43 fixes the problem. I solved it by applying a local patch fix according to browserify/webworkify#43 via https://www.npmjs.com/package/patch-package to the webworkify dependency. |
Please test the Edit: CI is not happy: #462. Please help to fix this. |
The CI works with the current As the changes are that minimal, I don't see an option which works for both with the current setup of the library and webpack 5. So I will close this issue for now. If anybody has any idea, drop it here and I will reopen it. |
@MatthijsBurgh the project could be bundled with Webpack 5 and its webworker implementation instead of Browserify with webworkify. |
I'm looking at the official documentation and the transport library "workersocket" (the one which breaks compatibility with webpack 5) is not even in the supported list of transport library. In fact, I can't even try to connect with this transport library using Typescript as the compiler won't let me set it to something unsupported. Why is the support of this transport library is necessary if it's not even in the docs? |
Moving to webpack will take significant time, which I don't have that much. So it will take a long time before it is there, unless other people could help. So if you have experience with webpack, please start working on it |
I will give it a try. I've worked with Webpack 5 a couple of times, but not its specific web worker implementation. I will keep you updated |
@maximeverreault Thanks! |
@maximeverreault any progress? |
I successfully converted the project to a Webpack project, but not the web worker implementation. So I'm pretty much stuck. Meanwhile (I really need the compatibility to Webpack 5), I am creating a new roslib implementation using Webpack with Typescript |
If anyone is having this issue with Angular, here is the package I was taking about : https://www.npmjs.com/package/ngx-roslib |
I've converted the codebase to ES Modules in #475 and it will be Webpack5-friendly after that is complete For anyone curious, Webpack 5 throws errors on any file that does not strictly follow Node.js ESM rules. This makes the code much more friendly to native browser ESM, but not necessarily compatible out of the box without an import map and shim modules. For example, after #475, importing the direct roslib source files won't work out of the box without a |
Speaking of TypeScript, I am planning to make a PR following #475 to convert it to ES My eventual goal is to compile it to WebAssembly with AssemblyScript (a TypeScript to WebAssembly compiler). |
I vote to delete WorkerSocket. Besides not being documented, and unless I overlooked something, it doesn't seem to do anything at all, and is adding complexity to the project for no gain. For example, as we can see right here: roslibjs/src/util/workerSocketImpl.js Lines 6 to 16 in 15cf667
It appears that the only thing this code does is receive WebSocket messages for the purpose of sending them back to the main thread. I myself have tried optimizations like these, and they were not fruitful in providing meaningful gains that outweighed their complexity. Network requests have never been a bottleneck in my cases. The bottleneck has always been with processing that is performed on data after receiving it (f.e. decompressing a JPG image, etc). Once the data is back on the main thread, if it is PNG data that needs to be decoded, then that is where CPU time will be spent. As we can further see in the next line, the Line 82 in 15cf667
A more beneficial feature would be a |
The purpose of WorkerSocket is decoupling the WebSocket handler from the main thread, so that WebSocket ACKs can be returned to the server as quickly as possible and offloading that backpressure to the client's Worker-to-main-thread leg. This is an optional mitigation and is even more relevant in ROS2 where the server backpressure OOM bug still exists. The WorkerSocket feature was implemented at the request of OSRF. |
See the WorkerSocket PR for more background and motivation: #317 |
Ah, thanks. I didn't know about that (I haven't blocked main thread enough for it to affect a backend yet). |
Bootstrap 5 including many required fixes/updates. Clean up CSS to use more pure bootstrap in buttons. New eslint version including changes to accommodate. Patch fix for roslibjs: - RobotWebTools/roslibjs#382 (comment) - RobotWebTools/roslibjs@52372aa
We need this for roslibjs in baktus-app. roslibjs issue: RobotWebTools/roslibjs#382 webworkify issue providing the solution: browserify#43
I have experienced the issue myself for the first time. I suggest that we use try {
var work = require('webworkify');
} catch(ReferenceError) {
var work = require('webworkify-webpack');
} This would also require to add edit: We could also switch completely to |
Full migration showed to not work in situations without webpack. So #512 is closed. |
#513 works with webpack 5.67.0 (via create-react-app), thanks! |
An issue with one of their dependencies was causing problems See RobotWebTools/roslibjs#382
I am using roslibjs for one of my projects that is currently trying to upgrade to Webpack 5 and I am running into some issues.
I've created a minimum reproducible project here:
https://github.com/amosbyon1224/roslib-webpack5
but the main issue seems to be with
webworkify
complaining aboutarguments
being undefined.roslibjs was working fine using webpack 4.27.1 but is now broken using webpack 5.6.0
The text was updated successfully, but these errors were encountered: