-
Notifications
You must be signed in to change notification settings - Fork 1
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
Load client from playground.wordpress.net instead of @wp-playground/client #79
Comments
I'm not sure I understand how this would work, could you clarify how we would use the client from |
Like this: <iframe id="wp" style="width: 100%; height: 700px; border: 1px solid #000;"></iframe>
<script type="module">
import { startPlaygroundWeb } from 'https://playground.wordpress.net/client/index.js';
try {
const mountDescriptor = {
device: {
type: 'opfs',
path: '/try-wp-zz',
},
mountpoint: '/wordpress',
};
const isWordPressInstalled = confirm('Is WordPress installed? Ok=yes; Cancel=no;');
console.log( isWordPressInstalled ? 'WP: Already Installed' : 'WP: Not Installed' );
const client = await startPlaygroundWeb({
iframe: document.getElementById('wp'),
remoteUrl: `https://playground.wordpress.net/remote.html`,
mounts: [mountDescriptor],
shouldInstallWordPress: ! isWordPressInstalled,
});
await client.isReady();
window.pgclient = client;
} catch (error) {
console.error("pg client", error);
}
</script> |
Thanks for clarifying. This might might make it a little better, but I see some invonveniences:
I think ultimately, the best solution would be to package playground into the extension. If that's not possible, for reasons outside our control (e.g. browser limitations), another possibility would be for playground.wordpress.net to provide multiple versions, e.g. https://playground.wordpress.net/v0.1.2. |
Agree! Or we can host our own instance |
I want to avoid breaking changes in For non-breaking changes, loading the client from playground.wordpress.net would actually keep the browser extension working – the client would be auto-updated in the same deployment as remote.html.
Isn't that true for any technique of importing the client?
Isn't there a way to configure TypeScript to still get types? Like an import map in tsconfig.json?
Yup, that would work too. If you host it on the atomic platform, you should be able to just fork the Playground repo and reuse the same deployment scripts. |
@adamziel made the suggestion to use the client from
playground.wordpress.net
itself to have a version that’s always synchronized with the Playground versionThe text was updated successfully, but these errors were encountered: