aframevr / aframe-inspector

:mag: Visual inspector tool for A-Frame. Hit *<ctrl> + <alt> + i* on any A-Frame scene.
https://aframe.io/aframe-inspector/examples/
MIT License
647 stars 198 forks source link

Replace fontawesome cdn by react-fontawesome #706

Closed vincentfretin closed 4 months ago

vincentfretin commented 5 months ago

This closes #692 Some icons slightly changed.

Remaining to do:

vincentfretin commented 4 months ago

Before: Capture d’écran du 2024-02-18 18-35-52

After: Capture d’écran du 2024-02-18 19-45-51

vincentfretin commented 4 months ago

I replaced clipboard by clipbard-copy mainly because I couldn't figure out how to stop the click event propagating and collapse the panel. Switching to clipboard-copy reduce a bit the bundle size: https://bundlephobia.com/package/clipboard@2.0.11 9kB minified https://bundlephobia.com/package/clipboard-copy@4.0.1 838B minified

We removed downloading https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css here, so 27K less to download as well.

Before this PR: 483K aframe-inspector.min.js After this PR: 551K aframe-inspector.min.js

increasing bundle to 68kB, wait this doesn't line up, I would had expected 490K maybe. I confirm bundling without clipboard-copy is 550K. So it's just the FontAwesomeIcon component that is 60K? That's crazy. I'll investigate further later, I'll probably create a simple Icon React component just to render the svg. I put this PR back in draft.

Also just to confirm this wasn't due to bad tree shaking, I replaced

import {
  faCamera,
  faCube,
  faFont,
  faLightbulb
} from '@fortawesome/free-solid-svg-icons';

to

import { faCamera } from '@fortawesome/free-solid-svg-icons/faCamera';
import { faCube } from '@fortawesome/free-solid-svg-icons/faCube';
import { faFont } from '@fortawesome/free-solid-svg-icons/faFont';
import { faLightbulb } from '@fortawesome/free-solid-svg-icons/faLightbulb';

the bundle increased by 3KB TT.

dmarcos commented 4 months ago

Thanks so much!