-
Notifications
You must be signed in to change notification settings - Fork 271
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
Lazy load PHP extensions (like dom and libxml) #89
Comments
I suppose that means the wordpress-playground/src/php-wasm/wasm/gulpfile.js Lines 37 to 38 in ddebea5
|
@westonruter It's been enabled by default, I disabled it to remove 1.21M from the bundle size (see #2). I do agree it can be useful, though! That's the problem of different use-cases – you don't need it for embeddable code snippets in a JavaScript-oriented WordPress course, but you do need it to use the Playground with certain WordPress plugins. An obvious solution would be hosting two PHP builds, with and without libxml, and having a configuration switch with some smart defaults. It would work as long as that's only about a single extension. For two, three, or five PHP extensions there would need to be something smarter. Perhaps pre-packaged "environments" for specific purposes? As in:
|
This list of recommended extensions might be helpful: https://make.wordpress.org/hosting/handbook/server-environment/#php-extensions |
Another idea: Emscripten supports dynamic libraries that are loaded lazily – Playground could use them to provide a lean initial bundle while also offering all the additional features. |
Here’s v8.dev article about an unrelated topic with an example implementation of lazy-loading wasm libraries. They use the experimental JSPI api, but it should also work with the existing stable Asyncify api: |
Actually – lazy loading may not be needed at all. Building PHP extensions to I just explored that today and managed to build XDebug. The next challenge is actually loading it in PHP, |
JSPI support just got merged and lazy loading is now technically possible – as described in https://v8.dev/blog/jspi. |
I tried uploading the Web Stories plugin, but the plugin gave an error notice:
The
dom
andlibxml
extensions should be enabled, as they are almost always available on WordPress sites.The text was updated successfully, but these errors were encountered: