Skip to content

Please don't be too aggressive to using the new JS feature syntax in build files #23480

@Molay

Description

@Molay

Describe the bug

Please don't be too aggressive to using the new JS feature syntax in build files.

The syntax of ES2020 features has been used in the current code and these will cause problems in dependent projects.

Given that the Three.js project is extremely widely used in the community, I think we should be cautious about these new features and maintain backward compatibility.

It is too radical at the moment.

To Reproduce

Code

// File: three.js/build/three.module.js Line: 15293
this._setSize( texture.image.length === 0 ? 16 : texture.image[ 0 ].width ?? texture.image[ 0 ].image.width );
                                                                          ^------ ES2020 Nullish Coalescing

Live example

Expected behavior

We should avoid using new feature syntaxes prematurely in the build files, and provide good compatibility as much as possible.

Or put a backwards compatible version in the build folder at least.

Screenshots

截屏2022-02-13 23 15 55

Platform:

  • Device: [Desktop, Mobile]
  • OS: [Windows, MacOS, Linux, Android, iOS]
  • Browser: [Chrome, Firefox, Safari, Edge]
  • Three.js version: [dev, 0946935]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions