Please don't be too aggressive to using the new JS feature syntax in build files
See original GitHub issueDescribe 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
Platform:
- Device: [Desktop, Mobile]
- OS: [Windows, MacOS, Linux, Android, iOS]
- Browser: [Chrome, Firefox, Safari, Edge]
- Three.js version: [dev, 0946935372f79e100ebeb2e3883d144d4ca5f80e]
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
Related: https://github.com/mrdoob/three.js/issues/22618#issuecomment-1025033832