-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Encountered process.env
when attempting to use @wordpress/block-library
outside of WordPress
#48949
Comments
I was able to replace |
I don't think those of us that worked on it realised the side effects this would have for package consumers. It's been that way for a while and it was originally thought it would be okay as there was (and still is) use of The It'd be good to think about how this could be fixed. |
I did find a solution, but if the intent is for the packages of Gutenberg to be usable outside the project a different approach for configuration would be more portable. Any thoughts on what the state of |
I guess one way to fix this is to ensure babel defines
Usually The best option may be to ensure |
@talldan thanks for the suggestion. I intent to leave this issue open. I understand I am using the library totally outside the context it was created in, but there is value in publishing the packages in a way that is easier to use outside of Gutenberg and it's build system. |
Decided this issue has a work around, it's documented here and people should be able to find it with a search, I'm closing it. |
In retrospect, There is a similar issue reported in #44950. |
I also recently encountered a similar error. That's when I tried to build a block editor for my React app by following Getting Started on platform-docs. I used Vite as a build tool, but it looks like the latest Vite has removed As mentioned in the comments below, I was able to work around this by add a |
Description
Why does
@wordpress/block-library
have a top level reference toprocess.env
? I am trying to learn Gutenberg by playing with it outside of WordPress and using minimal build tools. Does@wordpress/script
strip this out?gutenberg/packages/block-library/src/index.js
Lines 280 to 295 in 0722bc9
Step-by-step reproduction instructions
Use
registerCoreBlocks
of@wordpress/block-library
in the browser without@wordpress/scripts
, it will throw the following error:Screenshots, screen recording, code snippet
No response
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: