-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
[wordpress/script] wp-scripts build-blocks-manifest removes manifest file on start #69565
Comments
I'm having the same issue as of today. I'm running node v22.13.1, wordpress 6.7.2, and a bare-bones custom block theme. |
Thanks for the report. I was able to replicate it. I think this discussion may be related to this issue. cc @felixarntz @gziolo |
I took a look at that referenced discussion and did some digging (I suck at webpack), came up with a possible solution in @wordpress/wp-scripts, you can update the webpack.config.js to include something like
and then add that to the plugins in ScriptConfig here's my updated webpack.config.js, tested and working in my project |
We just ran into that issue at Cloudfest Hackathon. How about changing the start task like this?
By using a single |
work around for it?? @2ndkauboy your method isnt work for me, it puts the manifest there but removes it 1 second after, at least in my case |
I solved this in the following way: add this in package.json
I edited the block initialization file to use the /dist folder:
Use The build-blocks-manifest provides input and output parameters, and moving the file out of the build prevents it from being removed. https://github.com/WordPress/gutenberg/tree/trunk/packages/scripts#build-blocks-manifest |
the problem here is not with the build but with the start |
It would be removed if it were in the /build folder, but since it will be in the /dist folder, it will remain preserved. The solution I suggested (which I am currently using and is functioning correctly) aims to resolve the issue with |
I think the PR #69578 (based on @itsseanl's code above) is a cleaner solution, because it conditionally ties building the blocks manifest to the Webpack process. That way there's no need to have multiple commands in a single In the meantime, I think the above are reasonable workarounds until this has been fixed. |
Description
When using
"start": "wp-scripts start && wp-scripts build-blocks-manifest"
and runningnpm run start
,blocks-manifest.php
file is removed.When using
"build": "wp-scripts build && wp-scripts build-blocks-manifest"
and runningnpm run build
,blocks-manifest.php
file is generated as it should.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.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.
The text was updated successfully, but these errors were encountered: