-
Notifications
You must be signed in to change notification settings - Fork 12k
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
RxJS v6 testing breaking with ESBuild bundling (Jest testing) #25405
Comments
devversion
added a commit
to devversion/angular-cli
that referenced
this issue
Jun 20, 2023
…d `es2015` to main fields for RxJS v6 compatibility Currently, for RxJS v6, no conditions are available, and the ESBuild pipeline will select the ES5 distribution based on the `module` main field. This is fine in most cases, but applications could benefit from better optimization with the use of the ES2015 output + there are certain code differences that currently would cause runtime breakages when e.g. `rxjs/testing` is used. See: angular#25405 for more details. Fixes angular#25405.
This was referenced Jun 20, 2023
clydin
pushed a commit
that referenced
this issue
Jun 20, 2023
…d `es2015` to main fields for RxJS v6 compatibility Currently, for RxJS v6, no conditions are available, and the ESBuild pipeline will select the ES5 distribution based on the `module` main field. This is fine in most cases, but applications could benefit from better optimization with the use of the ES2015 output + there are certain code differences that currently would cause runtime breakages when e.g. `rxjs/testing` is used. See: #25405 for more details. Fixes #25405.
clydin
pushed a commit
that referenced
this issue
Jun 20, 2023
…d `es2015` to main fields for RxJS v6 compatibility Currently, for RxJS v6, no conditions are available, and the ESBuild pipeline will select the ES5 distribution based on the `module` main field. This is fine in most cases, but applications could benefit from better optimization with the use of the ES2015 output + there are certain code differences that currently would cause runtime breakages when e.g. `rxjs/testing` is used. See: #25405 for more details. Fixes #25405. (cherry picked from commit 9d9a668)
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. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Command
test
Is this a regression?
The previous version in which this bug was not present was
main
Description
Currently, using a builder that leverages ESBuild under the hood. e.g. the Jest builder- results in runtime breakages when RxJS v6 is used together with the
TestScheduler
code.Root cause:
RxJS v6 does not have exports conditions, so the
mainFields
will be respected. The ESBuild code pathdoes not match the ES2015+ main fields, but instead matches just
module
- causing the ES5 distributionto be bundled. This ends up breaking at runtime. If the
es2015
main field would have matched- no errorwould have occurred.
This seems to happen because, the ES5 distribution applies mixins for the
ColdObservable
class using a@PURE
side-effect call, while in ES2015 it's not marked as side-effect free.ES5 (breaking)
ES2015
Minimal Reproduction
https://github.com/devversion/rxjs-v6-esbuild-cli-breaking
Exception or Error
Anything else relevant?
Possible solutions:
es2015
as condition.The text was updated successfully, but these errors were encountered: