-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple build targets #30768
Multiple build targets #30768
Conversation
This currently breaks It would be nice to just build the evergreen build and use that for dev work. |
Great catch! This is fixed. I removed the |
dadb6e7
to
af2667f
Compare
Looks like the desktop build is failing due to dependency issues. Does anyone have any idea what the issue might be, there? The Safari 10 test also seems to be failing with a timeout. Unclear if that's related to the PR, but taking a look at the other open PRs it seems that it might be, since the other ones don't appear to be failing. |
96d010f
to
2e25ad6
Compare
8718bfb
to
11dafec
Compare
Rebased and ran |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the SDK builder point of view, this is good now 👍
1ec4c3e
to
98a88df
Compare
One issue I found: the Gutenberg integration at The |
Thanks, @jsnajdr! Interesting issue. I wouldn't have expected the Gutenberg build to require something present that it isn't shipping with. |
Yes, I'll double-check. I just want to point out that the |
✅Edge 18 appears to be working correctly, loading resources a single time from the evergreen folder. ✅Edge 17 appears to be working correctly, loading resources a single time from the evergreen folder. ✅Edge 16 appears to be working correctly, loading resources a single time from the fallback folder. ❌Edge 15 has a hard fail ("This page is having a problem loading") loading ✅IE 11 appears to be working correctly, loading resources a single time from the fallback folder. |
@sgomes rockin! let's go! |
583170b
to
e2005dc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
e2005dc
to
bc63bc6
Compare
Thi PR reworks the build infrastructure to support two separate builds, and to serve the correct one to each user, based on user agent string. Squashed commits: Unify browserslist usage based on package.json. This commit: - Uses the browserslist definition to configure Terser ES6 and browser-specific settings. - Prepares package.json for multiple browserslists, to enable builds for multiple targets. - Defines the BROWSERSLIST_ENV environment variable in the NPM scripts, which is used by all browserslist-aware tools to pick the right configuration. Hardcode IE8 support to false Add documentation for chooseTerserEcmaVersion function. Make Calypso generate two builds: evergreen and fallback. We currently have a single, fallback build, which includes support for every supported browser. This results in a large amount of polyfills and syntactic transformations which bloat the bundle and increase browser download and execution times. This PR aims to generate a separate evergreen build in production, and serve that build instead to evergreen browsers, by doing user agent detection. Other browsers will still work, since they have the fallback bundle, but known modern browsers will get the benefit of a smaller bundle. Remove assignment from noModule property. Write fallback build files to public/fallback. Fix dev builds and make them use 'evergreen' settings. Rename isEvergreen prop to addEvergreenCheck Only run AssetsWriter for client builds. Ensure non-client builds use defaults instead of evergreen. Remove unreleased Safari versions from browserslist. Make fallback and evergreen builds happen in parallel. Fix arrow functions being used as constructors Ensure that BROWSERSLIST_ENV is always defined in WebPack Remove NODE_ARGS from build-client-both Ensure that `analyze-bundles` correctly uses the evergreen build. Ensure that icfy-analyze.js uses the evergreen build. Fix build cache paths after changes to the build process.
bc63bc6
to
1a743a1
Compare
@sgomes after painful
When I open the build from this commit I get a blank electron app showing the following error:
Any idea why we might be missing the assets file? |
I spotted a suspect line in wp-desktop and opened a PR to see if it helps: Automattic/wp-desktop#605 |
Oh, actually I just saw @sirreal's PR. Not copying the file would do that too. Thanks, @sirreal ! |
@dmsnell Hmm, these warnings are interesting. I have no idea what could be causing them, but they seem to becoming from inside the dependencies, right? Are they causing any failures? |
Related to the |
That's a much older version than what we're using. Ours should have the fix. |
In any case, the WebPack warning seems to be indicative of a potentially larger bundle, not any sort of failure. That's not an issue, since this is server-side code. |
The fix for browserslist/browserslist#199 seems to be adding "browser": {
"./node.js": "./browser.js",
"path": false
}, According to the documentation (#, #), that would mean " |
It's not clear to me that's the right fix for us. That sounds like a fix for code that runs in a browser environment, whereas ours runs in a node environment. |
As far as I saw it didn't cause errors but I didn't check all the corners of the app. After going back and re-bisecting it looks like the Thanks everyone for your efforts to clean this up. Since the desktop app is building again I think that I was partially mislead by the warnings. The assets are now working and the app runs at least… |
Implement support for multiple build targets in Calypso.
We currently have a single build, which includes everything needed to support the lowest denominator in features across supported browsers. This results in a large amount of polyfills and syntactic transformations which aren't needed for the majority of users (who thankfully do use modern browsers), and ends up bloating the bundle and increasing browser download and execution times.
This PR aims to generate a separate evergreen build in production, and serve that build instead to evergreen browsers, by doing user agent inspection. Other browsers will still work, since they have the fallback bundle, but known modern browsers will get the benefit of a smaller bundle.
There's also a small "mustard test" that tries to prevent an old browser that somehow got the modern bundle from breaking (which shouldn't happen unless it's reporting a modern browser's UA). It does this by trying to determine in runtime if the browser "cuts the mustard" by checking for support for ES modules (a reasonable test for browser "modernness" at this point in time). If it fails, the browser gets redirected to a forced fallback build with
?forceFallback=1
. This is, as @blowery put it, a "belt and suspenders" approach, in trying to ensure that there is no breakage even if we somehow detect the UA incorrectly.Note: This PR replaces #30420.
Changes proposed in this Pull Request
package.json
, for evergreen browsers.Testing instructions
Evergreen:
/calypso/evergreen/
Non-evergreen:
/calypso/fallback
(not/calypso/evergreen/
)Compare the two:
=>
).Forced fallback:
?forceFallback=1
in an evergreen browser/calypso/fallback
(not/calypso/evergreen/
)