aframe-inspector icon indicating copy to clipboard operation
aframe-inspector copied to clipboard

Don't transpile to ES5

Open vincentfretin opened this issue 1 year ago • 2 comments

We used @babel/preset-env without browserlist config in package.json, so @babel/preset-env defaulted to ES5 and not browserlist defaults query that applies modern browsers. See doc https://babeljs.io/docs/babel-preset-env https://babeljs.io/docs/options#no-targets but really nowadays we don't need to transpile to ES5, that was at a time we needed to support IE11. We don't use any fancy javascript syntax here, only ES6/ES2015 that is supported by all supported browsers.

Bundle size reduced from 521K to 426K. Transpiling to ES5 included lots of polyfills we don't need.

vincentfretin avatar Sep 17 '24 11:09 vincentfretin

I just had the idea to do this PR while watching https://www.youtube.com/watch?v=odhjF1obcUo

vincentfretin avatar Sep 17 '24 11:09 vincentfretin

To use it:

<a-scene inspector="url: https://cdn.jsdelivr.net/gh/aframevr/aframe-inspector@ddda46f4376cf696e623721d98e1c2eb3e799b73/dist/aframe-inspector.min.js">

vincentfretin avatar Sep 25 '24 16:09 vincentfretin

We could also just remove the single test https://github.com/aframevr/aframe-inspector/blob/master/src/components/tests/Collapsible.test.js and jest, babel-jest, react-test-renderer dependencies instead of reintroducing @babel/preset-env in https://github.com/aframevr/aframe-inspector/pull/772/commits/f8f9035ae935c7d8416b0126fa6f326d50c8242f @dmarcos thoughts?

vincentfretin avatar Nov 13 '24 16:11 vincentfretin

Yeah we don't need to transpile to ES5 I think. Is this ready to merge?

dmarcos avatar Nov 14 '24 02:11 dmarcos

You can merge as is yes.

vincentfretin avatar Nov 14 '24 10:11 vincentfretin

Thanks so much!

dmarcos avatar Nov 14 '24 15:11 dmarcos