-
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
Scripts: Fix Entry points are not detected in Windows OS #38781
Conversation
Size Change: +506 B (0%) Total Size: 1.15 MB
ℹ️ View Unchanged
|
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.
Oh no, this issue is back. We have now verification for Windows through a GitHub action but the test block is put directly in the src
folder so it didn’t catch it 🙈
Thank you for opening a fix so quickly. I left a comment but it probably doesn’t matter that much. Let’s test it and land as soon as possible.
I've refactored the code. |
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.
Code looks great. I’ll give it some more testing before merging and publishing to npm. Thank you for contributing 👍
Tested locally and everything works great 👏🏻 |
* Scripts: Fix Entry points are not detected in Windows OS * Update changelog files * code refactoring * Let's update the changelog according to the npm publishing planned Co-authored-by: Greg Ziółkowski <[email protected]>
|
See: #38343, #38348
Description
The entry point is not detected and the build file is not generated on Windows OS when placing the JavaScript file that will be the entry point in a subfolder.
I fixed that problem in this PR.
It would be great if you could test it on Windows OS and Mac OS, if you like.
Testing Instructions
Check out this branch.
Run create-block without installing wp-scirpts.
(I added some PHP files to to test the copy of the PHP files as well)
start
orbuild
command to generate assets.Build result before fix
The
block.json
and PHP files will be copied, but the JavaScript will not be built.Also
index.assets.php
was not generated.You will also see the following message, indicating that the entry point was not detected.
808c1bd7ae7bf03b60d23b030b8973fe.mp4
Build result after fix
All assets should be generated correctly as shown below with this fix.
Types of changes
gutenberg/packages/scripts/utils/config.js
Lines 231 to 241 in c034da1
At this point, the path separator for
entryName
will be a backslash.Therefore, the regular expression string in the
glob
for detectingentryFilePath
will be replaced by a string with different delimiters mixed in, as followsAs described in the v3.0.0 release notes, I think the reason is that only forward slashes are allowed in regular expressions in globs, and slash replacement is no longer processed.
I was a little confused about how to write it, I simply added a process to replace the regular expression string with a forward slash to minimize the scope of the impact.)
Checklist:
*.native.js
files for terms that need renaming or removal).