WP-NOW: add crypto dependency globally available in node#153
Closed
sejas wants to merge 1 commit into
Closed
Conversation
…we need to import it.
Collaborator
|
@sejas this PR would nicely fit Playground core, as every Node.js Playground consumer will experience this problem. Would you mind starting one to update the |
Collaborator
Author
|
@adamziel , moved the PR here: WordPress/wordpress-playground#1000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
@adamziel fixed the polyfills to run the flag --blueprint without any issues, but installing a plugin throws an error:
ReferenceError: crypto is not definedWhy?
The blueprints use
crypto.randomUUID, but in node we need to importcrypto.How?
In this PR I inject the default node library to be globally available.
Other alternatives could be adding the import directly on
@wp-playground/blueprints, or replace the randomUUID for another function.Testing Instructions
nvm use && npm installnpx nx build wp-nowb.jsonwith a blueprint that installs a plugin.node dist/packages/wp-now/cli.js start --blueprint=b.jsonb.json