-
Notifications
You must be signed in to change notification settings - Fork 12k
Web Worker support #13700
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
Web Worker support #13700
Conversation
9f269a9
to
0b19406
Compare
@filipesilva I'm following this feature closely and I can see worker plugin won't support lazy loading. it's only a suggestion. Why don't you bundle the workers using webpack multiple targets? Or maybe you are not doing this thinking in platform-webworker? |
@Serginho at the moment I'm just following the base functionality of https://github.com/googlechromelabs/worker-plugin. It only supports |
0b19406
to
c203f94
Compare
packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts
Outdated
Show resolved
Hide resolved
packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/worker.ts
Show resolved
Hide resolved
651a873
to
c4d7750
Compare
0717c0a
to
7471ca1
Compare
7bcfd12
to
b35f1ad
Compare
c7041a1
to
d361f51
Compare
d361f51
to
f9def41
Compare
638fc11
to
8c14243
Compare
// Add project tsconfig.json and tsconfig.worker.json. | ||
// The project level tsconfig.json with webworker lib is for editor support since | ||
// the dom and webworker libs are mutually exclusive. | ||
// Note: this schematic does not change other tsconfigs to use the project-level tsconfig. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This schematic makes a two new tsconfig files:
path/to/project/tsconfig.worker.json
for the worker TS compilation itselfpath/to/project/tsconfig.json
for the editor to support both DOM and WebWorker typings inside the project
As is I did not make the remaining tsconfigs in path/to/project/
extend path/to/project/tsconfig.json
because it's hard to ensure they are the default tsconfigs we generate on a new project.
But I believe we should eventually transition into having a path/to/project/tsconfig.json
anyway in all projects because of other editor support issues like #8138 (comment).
// 'src/worker/dep.ts'. | ||
// But increasing this delay to 5s lead to no failed test in over 40 runs locally. | ||
// In CI I still saw a rebuild fail with 5s, so I increased it to 10s. | ||
// I think there might be a race condition related to child compilers somewhere in webpack. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still saw a failure with the 10s debounce time in https://circleci.com/gh/angular/angular-cli/43023#tests/containers/1. Need to debug further.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@filipesilva Is it possible the child compiler needs additional plugins? If it does and their configuration is the same, adding a string match pattern to the plugins[]
option in worker-plugin would copy them over.
I'm not sure where to look in this repo to peek at how file watching is being done, any tips appreciated!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm looking at this currently. I'm not 100% sure of what the problem is but I've managed to reproduce it locally. I think it's related to the shared bits of our TS compilation pipeline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I figured it out, let's continue the conversation in the other comment (#13700 (comment)).
Will this also enable shared workers as well? |
@owenhaynes I'm not sure what you mean, can you give an example please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really good!
Couple of small things above.
1e3e52e
to
44dbe6e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
44dbe6e
to
e44e508
Compare
Supports new Worker(...,{type:module}) using github.com/googlechromelabs/worker-plugin
e44e508
to
4c92bad
Compare
Followup to angular/angular-cli#13700 PR Close #29633
…lder Followup to angular#13700, the karma builder did not get the same support but it should.
…lder Followup to #13700, the karma builder did not get the same support but it should.
Followup to angular/angular-cli#13700 PR Close angular#29633
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Followup to #12575
Todo:
@angular-devkit/platform-worker
Close #5885