-
Notifications
You must be signed in to change notification settings - Fork 42
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
wp-now: ReferenceError: DOMParser is not defined while installing the plugin #113
Comments
@sejas This is because the |
I've created a draft PR, but it's not so easy. We may need to modify the blueprints to be more isomorphic. @adamziel, would you have bandwidth this week to help me a bit? |
@sejas I replied in that PR, thank you for looking into this! |
After updating the dependencies that add the Polyfills, I'm still seeing an error thrown by |
…1000) - Similar to #875 - Related to WordPress/playground-tools#113 ## What is this PR doing? It imports the native library `crypto` and makes it globally available in the runtime. ## What problem is it solving? When using blueprints that install plugins or themes, it generates a random folder using [`crypto`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto)`. That library is available in the browsers by default, but for node we need to import it. Note that it do not install any dependency since Crypto is already built in NodeJS, but it's not imported by default. I decided to use [`node:crypto`](https://nodejs.org/api/webcrypto.html) which has `webcrypto` and will be a better match. It's available sine Node v15. The other alternative is normal [crypto](https://nodejs.org/api/crypto.html) https://nodejs.org/docs/latest-v14.x/api/crypto.html, which also has `crypto.randomUUID`. It's available since Node v14. ## How is the problem addressed? It adds a new Polyfill for crypto. ## Testing Instructions 1. Comment the first line `import './crypto';` on `packages/php-wasm/node-polyfills/src/lib/crypto.spec.ts` 2. Run `npx nx test php-wasm-node-polyfills` 3. Observe the tests fail 4. Uncomment first line `import './crypto';` on `packages/php-wasm/node-polyfills/src/lib/crypto.spec.ts` 5. Run `npx nx test php-wasm-node-polyfills` 6. Observe the tests pass
@sejas can this issue be closed now? |
Yes!, Let's close it, the installPlugin and installTheme blueprints are already fixed. 👌 |
My blueprint:
And the result:
The plugin can be installed just fine from the wp-admin.
Also looks like there's a small typo:
The text was updated successfully, but these errors were encountered: