-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
tests: add page functions bundling test #15280
Conversation
@@ -67,3 +67,4 @@ yarn.lock | |||
**/*.d.cts | |||
!**/types/**/*.d.ts | |||
|
|||
page-functions-test-case*out*.js |
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.
Some unit tests store random output files in the .tmp
directory. WDYT about moving this output there?
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.
I prefer where it is, since it is right next to the input file. Nicer for debugging.
Does it make sense to take a wider perspective for a minute on the purpose of page functions? The fundamental goal is just to pass strings of javascript over the protocol to evaluate in the browser context. We created In the service of that goal we keep adding layers to Should we take a look at any possible simpler approaches to how we do page functions? There aren't that many uses of |
Sure, it makes sense to see how we could redesign it all to make things like this not necessary. As it is, this complexity already exists, so these tests just help wrangle it. And we must enable esbuild minification to un-stuck the build transition (we can't accept the regression in bundle size from #15239). So - land this and #15283 and evaluate some different approaches (prev discussion: #12771 (comment) #12795) for 11.0? |
This plan generally SGTM but I'm hesitant to expand the scope of 11.0 at this point. I wouldn't want it to be a release blocker. Also, is it necessarily a breaking change? |
ExecutionContext is expose in our public gathering api, so it could be. |
FWIW #12795 did work with esbuild two years ago (all functions become local, so the relative re-naming doesn't matter), and esbuild hasn't changed that much since then. But I'm also talking about even more fundamental reevaluating, going back to asking what exactly we need this to do, and what's the simplest way to accomplish that. |
These tests are a huge help in debugging issues with
build-bundles
wrt name mangling, which we work hard to avoid.All of the minified variants of these tests currently fail if you switch
buildBundle
to use esbuild's minification.Note: it is an official warning in the documentation that we shouldn't expect
.toString
to work for us :)