Add Perl script to list JS dependencies and suggest a load order#965
Closed
Add Perl script to list JS dependencies and suggest a load order#965
Conversation
Member
Author
|
I meant to include example output here as well: A more robust version of this task would actually parse the JS files instead of just looking for a regex like |
Member
|
Are we depending on a specific load order? |
Member
Author
|
Yes. On the server this is handled by registering script dependencies via WordPress's standard mechanism; also, the test build will break if the entry points in the Webpack config are rearranged sufficiently. I'm fine with closing this out and saving the script that way. I opened a PR because I found it useful, and it may be more useful in the future. |
Member
|
I'm indifferent. Fine with merging, or as Gist territory. |
Member
Author
|
This can live at https://gist.github.com/nylen/e9bcda0ee6c2c21e9f0063d9cdebd7e9. |
Member
Author
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I wrote this script while I was working on #929 to better understand the dependencies between our various Webpack bundles. I'm not sure that we want to add this to the repo or not, but it was useful to me to determine the needed order of these modules in our Webpack config. (This is mainly important for the test build, as in the actual plugin this is handled via WP's script dependency resolution mechanism).
It's a bit unfortunate that we have to do this twice (once on the client side and once on the server side). However, I'm also thinking that this script (or something like it) will come in handy to calculate actual dependencies when we start adding more Webpack-built files to WP core.