-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Script Modules: Centralize (re)registration #65460
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
487a982
PICKME: Add build-module to GH actions
sirreal 11c63fe
Fix artifact download
sirreal 44dd78f
Remove block-library view script module registration on render
sirreal 508cbba
Produce combined script modules assetfile
sirreal 00a196b
Fix script module webpack filenames
sirreal a148c74
Remove specific interactivity script module registration
sirreal 5015d56
Handle re-registration of core script modules
sirreal b0b3e72
Fix script module re-registration
sirreal 370f2e6
Move script module registration out of experimental
sirreal 1bad15c
Just use assets.php
sirreal cb3a31b
Replace WP modules action with GB modules
sirreal 476183a
Update function name, add deprecation note
sirreal 3f457a5
Properly trim .min.js and .js
sirreal 6759367
Remove unused filter function
sirreal ff352fc
Simplify module id creation and special casing
sirreal 23bff87
Add core-backport file
sirreal b8e11bc
Use .min.js for webpack filename extension
sirreal 8386d14
Merge branch 'fix/build-module-cached-unit-test-asset' into fix/block…
sirreal 44da0b0
Use non-minified assets with SCRIPT_DEBUG
sirreal e99b96e
Remove usage of non-min .js files in Script Debug
sirreal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Move script module registration out of experimental
- Loading branch information
commit 370f2e6e75d6a8b8a41f15d7495f9b60966f0e96
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
There is a slight change that needs to get incorporated here. There should be a different file served depending on
SCRIPT_DEBUG:true:.jsfalse:.min.jsThere 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 not that sure anymore after looking at how scripts for packages are handled:
gutenberg/lib/client-assets.php
Lines 190 to 238 in 5e37a13
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.
👍 Done.
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 didn't have the latest version of the branch 🙈
This is what I see now with
npm run dev:I still do not think I understand it fully.
.min.jsis always produced when you usenpm run devandnpm run build.mode === 'production' && new ReadableJsAssetsWebpackPlugin(),means that.jsgets only generated for production builds -npm run build. From the docs of the webpack plugin:I'm still puzzled why there is no
SCRIPT_DEBUGinvolved like in WP core.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 think we can remove 44da0b0 for now and ship it all as is.
Uh oh!
There was an error while loading. Please reload this page.
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.
The same folder after
npm run build:Notice
.jsand.min.jsfiles get created. Fornpm run devI see only.min.jsfiles 🤷🏻 In effect, it behaves like in debug mode. However, once the plugin gets released, there is no longer a way to use the debug version. In fact, it probably doesn't make too much sense, because.jsfile is built with production mode.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.
Yes, it's confusing. When doing a development build,
.min.jsfiles are produced but they're not minified. The SCRIPT_DEBUG doesn't change the files Gutenberg uses.I've reverted the
.min.js/.jschanges.