-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Add Perl script to list JS dependencies and suggest a load order #965
Conversation
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 |
Are we depending on a specific load order? |
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. |
I'm indifferent. Fine with merging, or as Gist territory. |
This can live at https://gist.github.com/nylen/e9bcda0ee6c2c21e9f0063d9cdebd7e9. |
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.