-
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
Cant compile block after installing via @wordpress/create-block #38526
Comments
Hi, Just to be sure, is the error message exactly the same on node 16? |
Thanks, yes its the same with 16 for me. After I run However if I go to |
Ok I figured out the issue. The path that my WordPress directory is '/home/mark/Development/www/WordPress/ The Webpack file tries to extract the filename by splitting the path between So the soultion for me is to rename the 'src' directory that my WordPress install is located in. The function is in config.js here in case you think it needs to be addressed, but it might be an edge case.
|
Interesting find; thanks for sharing, and glad it worked out for you! It's an interesting edge case but worth pinging @gziolo what his thoughts are. |
I will provide the fix tomorrow. Thank you for the report and sharing your findings. It sounds like an edge case but we surely should avoid it. 👍 I can imagine it also working incorrectly when you would reference a file in your plugin outside of the inner |
I opened #38584 that should address it. |
Perfect, thank you for working on this. |
It should be published to npm on Thursday at the latest. |
Description
I am trying to create a Block by running 'npx @wordpress/create-block demo'.
The block fails to compile though, with the following output:
`Creating a new WordPress plugin in "demo" folder.
Creating a "block.json" file.
Creating a "package.json" file.
Installing
@wordpress/scripts
package. It might take a couple of minutes...Formatting JavaScript files.
Compiling block.
/home/mark/.npm/_npx/0890e296436e9575/node_modules/execa/lib/error.js:59
error = new Error(message);
^
Error: Command failed with exit code 2: npm run build
[webpack-cli] Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
function | object { : [non-empty string, ...] (should not have fewer than 1 item, should not have duplicate items) | non-empty string | object { import, asyncChunks?, chunkLoading?, dependOn?, filename?, layer?, library?, publicPath?, runtime?, wasmLoading? } } | [non-empty string, ...] (should not have fewer than 1 item, should not have duplicate items) | non-empty string
-> The entry point(s) of the compilation.
Details:
[non-empty string, ...] (should not have fewer than 1 item, should not have duplicate items) | non-empty string
-> Module(s) that are loaded upon startup.
Details:
[non-empty string, ...] (should not have fewer than 1 item, should not have duplicate items)
-> All modules are loaded upon startup. The last one is exported.
-> The string is resolved to a module which is loaded upon startup.
object { import, asyncChunks?, chunkLoading?, dependOn?, filename?, layer?, library?, publicPath?, runtime?, wasmLoading? }
-> An object with entry point description.
[non-empty string, ...] (should not have fewer than 1 item, should not have duplicate items) | non-empty string | object { import, asyncChunks?, chunkLoading?, dependOn?, filename?, layer?, library?, publicPath?, runtime?, wasmLoading? }
-> An entry point with name.`
I have tried using different config settings in @wordpress/create-block and different versions of node (versions 12, 14, 15, 16). I have searched online to see if I could find anyone else with a similar issue but can't find any similar issues.
I don't think it should make a difference but I am also running Wordpress from a docker container.
Step-by-step reproduction instructions
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: