Conversation
0455be4 to
0ec7d84
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5589 +/- ##
==========================================
+ Coverage 85.55% 85.56% +0.01%
==========================================
Files 320 319 -1
Lines 31415 31411 -4
Branches 8662 8670 +8
==========================================
Hits 26876 26876
+ Misses 4108 4104 -4
Partials 431 431 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
4ffc248 to
03f4d99
Compare
9e3eff2 to
31d83b2
Compare
a9cf93b to
bd3f05a
Compare
f7b5e5f to
3cee9ec
Compare
scripts/lib/build-utils.mjs
Outdated
| } | ||
| } | ||
|
|
||
| export function saveMetafile(buildResult, outputPath = 'dist/metafile.json') { |
There was a problem hiding this comment.
What is metafile exactly? I see that when we build, it puts the meta file to the metafile.json to the dist directory. Should we remove it at the end? Will it be exposed to web if it gets uploaded?
There was a problem hiding this comment.
Ah, good question. It might make sense to have nested directories under dist/ for the various things.
E.g.:
dist/browser-build-prod/...dist/meta/browser-build-prod.jsondist/browser-build-dev/...dist/node/symbolicator-cli.js
There was a problem hiding this comment.
Actually let's just keep the directory structure as-is.
You're right, the metafile was making it into the production output, which definitely was not what I intended. Let's stop emitting it by default; we don't need it, it's just there in case you want to do some bundle size profiling. And when we do emit it, we can put it outside of dist, for example into a new build-meta directory.
There was a problem hiding this comment.
Ah yeah, I would prefer to keep the dist directory as is too. Sounds good to move this file out of dist.
| export const photonConfig = { | ||
| ...baseConfig, | ||
| format: 'esm', | ||
| platform: 'browser', | ||
| target: ['es2022'], | ||
| sourcemap: true, | ||
| publicPath: '/photon/', | ||
| entryPoints: ['res/photon/index.js'], | ||
| outdir: 'dist/photon', | ||
| }; |
There was a problem hiding this comment.
Currently yarn start-photon shows me 404 when I visit http://localhost:4243/photon/ . I think we don't copy the photon/index.html file. Could you fix that?
canova
left a comment
There was a problem hiding this comment.
Thanks for the PR!
I did some comparisons in the before and after of the dist/ directory after yarn build-prod and I can already see some nice improvements:
The total size of directory went from ~23M to ~22M.
Main bundle size went from ~1.6M and ~1.1M
I see total JS bundle size went from ~2.3M ~1.4M.
I think the main difference of the JS size difference is that webpack bundles the CSS with JS, and now CSS is moved to its own CSS file. I think it's a nice improvement.
Apart from that, I see that we stopped auto prefixing (and possibly minifying) the CSS though. See my comment below in postcss.config.js. What do you think?
|
|
||
| // Plugin to mark chrome:// URLs as external in CSS | ||
| // | ||
| // This is a workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=2014811 |
There was a problem hiding this comment.
Ah looks like it's resolved but not published yet. It would be nice to file an issue to clean this up later.
scripts/lib/esbuild-plugins.mjs
Outdated
|
|
||
| for (const modulePath of Object.keys(inputs)) { | ||
| if (!modulePath.includes('node_modules')) { | ||
| findCycles(modulePath, []); |
There was a problem hiding this comment.
Shouldn't this be like this?:
| findCycles(modulePath, []); | |
| findCycles([], modulePath); |
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
| module.exports = { | ||
| plugins: [require('cssnano'), require('autoprefixer')], |
There was a problem hiding this comment.
Hmm I don't see postcss anymore in the codebase, but we still have it in the package.json. Did we stop transforming the CSS now?
Edit: Checking the css, I think we stopped prefixing the css properties now with autoprefixer for webkit etc. For example, I don't see -webkit- equivalent of user-select: none;. I think this might create a real compat issue in Safari. What do you think? I see that there is esbuild-plugin-postcss if we want to have it still.
There was a problem hiding this comment.
Oh indeed, without the webkit prefixed version, I can see text selection happening e.g. in the "tabs" when I right-click them. I'll add the postcss plugin.
There was a problem hiding this comment.
Rather than using the postcss plugin, I chose https://www.npmjs.com/package/browserslist-to-esbuild and replaced target: 'es2022' with target: browserslistToEsbuild(); specifying browser versions rather than ECMAScript versions will cause esbuild to do the prefixing for us, see https://esbuild.github.io/content-types/#css .
canova
left a comment
There was a problem hiding this comment.
Looks good to me overall, thanks again for the work! I'll let you handle the landing after you look into the postcss stuff.
Main branch / Deploy preview