Move worker into webpack build #495

Merged
Irev-Dev merged 2 commits from kurt/494-move-worker-into-webpack-build into main 2021-09-08 10:14:26 +02:00
Irev-Dev commented 2021-09-07 22:32:32 +02:00 (Migrated from github.com)

@hrgdavor This is the initial work to get the working into the build process, I would like to keep working later on this. Like you said because this was proof of concept code that you had copied from previous work, it would be good to trim down dead code not relevant to this use case (e.g. canvas stuff). I removed some that I was confident but my goal atm was just to get it out of the public asset folder atm.

As part of it being moved out of the public folder, suddenly the linter recognised the file as code it could format so this is a much better diff 22da074965


The jscad worker code was hosted as a static asset, making it odd
javascript where we have to be conscious of what javascript features we
can use and if it will work on older browsers, plus it can't be
typescript like the rest of the codebase.

Since redwood 0.36 we using webpack 5 should make loading workers easy
https://webpack.js.org/guides/web-workers/
But I had trouble with this (see:
https://community.redwoodjs.com/t/has-anyone-tried-workers-with-webpack-5-rw0-36-x/2394)
and instead used the webpack 4 loader without any issues

This issue relates to #411 , and is a checklist item on #444
Resolves #494

@hrgdavor This is the initial work to get the working into the build process, I would like to keep working later on this. Like you said because this was proof of concept code that you had copied from previous work, it would be good to trim down dead code not relevant to this use case (e.g. canvas stuff). I removed some that I was confident but my goal atm was just to get it out of the public asset folder atm. As part of it being moved out of the public folder, suddenly the linter recognised the file as code it could format so this is a much better diff https://github.com/Irev-Dev/cadhub/commit/22da074965354fd7ec23e6b59473a06485832bd4 ------ The jscad worker code was hosted as a static asset, making it odd javascript where we have to be conscious of what javascript features we can use and if it will work on older browsers, plus it can't be typescript like the rest of the codebase. Since redwood 0.36 we using webpack 5 should make loading workers easy https://webpack.js.org/guides/web-workers/ But I had trouble with this (see: https://community.redwoodjs.com/t/has-anyone-tried-workers-with-webpack-5-rw0-36-x/2394) and instead used the webpack 4 loader without any issues This issue relates to #411 , and is a checklist item on #444 Resolves #494
hrgdavor (Migrated from github.com) approved these changes 2021-09-07 23:33:51 +02:00
hrgdavor (Migrated from github.com) left a comment

Changes look good.

Worker code is not accessible via debugger, but that is expected for bundled workers.

a lot can be done with console.log :D .... so if debug is really needed at some point for worker, this could be looked into then.

... anyway, it is ok with me

Changes look good. Worker code is not accessible via debugger, but that is expected for bundled workers. a lot can be done with console.log :D .... so if debug is really needed at some point for worker, this could be looked into then. ... anyway, it is ok with me
Irev-Dev commented 2021-09-08 10:14:20 +02:00 (Migrated from github.com)

Thanks @hrgdavor

Thanks @hrgdavor
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: h3n3/cadhub#495