GoogleChrome / lighthouse-ci

Automate running Lighthouse for every commit, viewing the changes, and preventing regressions
Apache License 2.0
6.34k stars 635 forks source link

Fix static subresource paths for server/viewer #879

Closed paulirish closed 1 year ago

paulirish commented 1 year ago

Fixes #875

Basically a continuation from last year's https://github.com/GoogleChrome/lighthouse-ci/pull/753 and more specifically https://github.com/GoogleChrome/lighthouse-ci/pull/786

The short version is... esbuild consuming HTML and css is rough. Parcel treated us well.

in 786 we fixed static serving (the viewer) but made sure the express-based serving (the server) still worked. it did until it didnt. maybe some dependency bumps? shrug.

But...... this works. I spent a bunch of time making a more generalized solution. I ended up for something sliiiiightly more specific, but I'm still happy with it.

oh.. and just like in https://github.com/GoogleChrome/lighthouse-ci/pull/786 ...

some development notes of course the root problem is plenty of because paths. and express (sometimes) but not all the time. i used these to iterate. ```sh # from viewer folder find ../../scripts/build-app.js ./src/ui | entr bash -c "rm -rf ../viewer/dist/*; yarn build; cat dist/index.html" # from server folder find ../../scripts/build-app.js package.json src/| entr bash -c "rm -rf ../server/dist*; yarn build:esbuild; bat dist/index.html" ```