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.
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
Scripts: Change webpack configuration to include
render
files in the build folder #43917Scripts: Change webpack configuration to include
render
files in the build folder #43917Changes from 3 commits
f20c355
c0992c0
291d942
8f7fd61
9e4dc01
71df6dd
d532e2e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use wordpress-scripts in our build system, and it doesn't work anymore. The whole thing is more complex, but basically, there is what it does: https://github.com/loxK/wordpress-scripts-test
Any clue on what to do to make it work again ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @loxK. I've just cloned your repository, done a
npm install
(using node 16) andnpm run build
, and it worked fine.I'm not sure what may be going on. Could you please try removing the
node_module
folder and runningnpm install
again? Or giving us more precise instructions to reproduce the problem?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to upgrade @wordpress/scripts to 24.1.0 by editing packages.json and
npm i
, in the repository the wordpress-scripts version is fixed to 24.0.0.I upgraded it in the repository,
git pull
it andnpm i
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha.
For some reason,
process.env.WP_SRC_DIRECTORY
isundefined
in your configuration. I'll investigate why.It wasn't failing before because you overwrote the entry points (which also access
process.env.WP_SRC_DIRECTORY
).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, it's because you're using
"build": "webpack"
and not"build": "wp-scripts build"
in yourpackage.json
.wp-scripts build
initializesprocess.env.WP_SRC_DIRECTORY
:gutenberg/packages/scripts/scripts/build.js
Line 27 in 0a0598f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry, but I don't know the answer. You need to find a way to switch back to
wp-scripts
, or you'd have to take a look at its internals to understand what it's doing before it loads webpack to do that yourself. You're also welcome to open a PR if you think there's something broken insidewp-scripts
🙂There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Damn breaking change in a minor release version number. Hours of work ahead ...
That sucks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extending webpack is not covered with semver, especially when not used in conjunction with
wp-scripts
.From the docs:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, if you have needs that
wp-scripts
don't support yet and you think they'd be useful for a wide range of people, I encourage you to open an issue/PR to add those improvements towp-scripts
🙂I also encourage you to open a PR if you think there's something broken or that could be done in a better way inside
wp-scripts
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reference, @loxK opened a PR to change the way the webpack config access the value of
process.env.WP_SRC_DIRECTORY
: