The compiler pollutes the Object constructor #38967
Labels
area-web
Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop.
P4
web-dart2js
This tracker is for issues related to:
I originally posted this as a dart-sass issue (sass/dart-sass#851), but was told to move it here as it relates to the compiler for this sdk.
Here is the code in question:
sdk/pkg/compiler/lib/src/js_emitter/native_generator.dart
Lines 48 to 50 in 5721d8a
The code sets something directly on the Object constructor. As a general rule of thumb, you should never set anything on native prototypes or constructors, and this particular line causes issues with another project (object-hash). You can view an example of the interaction mismatch at https://codesandbox.io/s/pensive-worker-tnwrs - you'll notice you get a different hash output for the same object if you comment out the require for
sass
(which is a byproduct of it using the compiler from this project).Please find a different way other than setting variables on built ins to do whatever this chunk of code is trying to do.
The text was updated successfully, but these errors were encountered: