question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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, 0946935372f79e100ebeb2e3883d144d4ca5f80e]

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
donmccurdycommented, Feb 14, 2022

Newer syntax is not just for developer convenience - it often runs faster than code transpiled to older JS versions. And in some cases (ES6 Classes) affects users’ code in deeper ways.

I think my preference would be to pick a threshold that is modern but not bleeding edge (e.g. ES2018) and both write and release code within that threshold. For older browsers, I think it’s a fair expectation that users must transpile the library to their specific target requirements.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[FLUSH CHUNKS]: Unable to find pages-Home in Webpack ...
When I start with a fresh yarn.lock and a fresh node modules install, the build is still nested ( Home.js file under pages/...
Read more >
Angular 14 - Polyfills don't work for older browsers
I have an Angular 14 app built with all the default settings of a new project. This is my .browserlistrc. The generated index.html...
Read more >
TypeScript Features to Avoid - Hacker News
The arguments against the four language features in this article all boil down to it not being Javascript. If I wanted to write...
Read more >
Advanced Compilation | Closure Compiler - Google Developers
The solution in this situation is to implement a set of externs defining the public API of your library.
Read more >
Top 18 Most Common AngularJS Developer Mistakes - Toptal
A new model would not be set on the current scope, so no masking would occur: function ... Common Mistake #3: Not Using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found