Skip to content

The compiler pollutes the Object constructor #38967

@jas7457

Description

@jas7457

This tracker is for issues related to:

  • dev_compiler

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:

var tableProperty = "___dart_isolate_tags_";
var usedProperties = Object[tableProperty] ||
(Object[tableProperty] = Object.create(null));

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.web-dart2js

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions