[wp-trac] [WordPress Trac] #48154: Build Tools: Integrate DependencyExtractionWebpackPlugin in the JS build
WordPress Trac
noreply at wordpress.org
Mon Feb 24 05:49:53 UTC 2020
#48154: Build Tools: Integrate DependencyExtractionWebpackPlugin in the JS build
------------------------------+-------------------------
Reporter: gziolo | Owner: gziolo
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: 5.4
Component: Script Loader | Version:
Severity: normal | Resolution:
Keywords: has-patch commit | Focuses: javascript
------------------------------+-------------------------
Comment (by gziolo):
Replying to [comment:49 azaozz]:
> In 48154.diff:
> - Set it to output a single file, then copy that file to both
`SOURCE_DIR` and `BUILD_DIR` as `wp-includes/assets/script-loader-
deps.php`.
> TODO/TBD: Wondering if the assets file should be committed like the rest
of the PHP files in `wp-includes/blocks`? Any other ideas/tweaks?
Yes, I think we should do it now that we have only one file that can
change. It would solve all the issues discussed above because all asset
definitions are always there. In fact, it's how PHP files for blocks are
handled so it would align nicely. We just need to remove svn ignore for
the folder. In general, this file would only change when packages get
updated.
> For the record: Tried to use grunt includes to "concatenate" the assets
file directly in script-loader.php. It works great for /build, but works
only once for /src (as script-loader is modified). That modification can
be committed, but after the next packages update will have to be reverted
manually to get the new assets again... Can probably play with this a bit
and get it to work, but the way it works currently seems cleaner and
simpler.
It's fine to have one file to include that contains this large array. It
might even be cleaner because it's machine-generated thus hard to read for
reviewers.
{{{#!php
<?php
$assets = include ABSPATH . WPINC . '/assets/script-loader-deps.php';
$packages = array_keys( $assets );
}}}
I like this part the most that allows removing the list of packages which
was maintained manually so far. In fact, it's less error-prone because it
is generated by webpack so we have now a single source of truth. I think
we can also remove the list of packages that have translations and perform
a simple check whether `wp-18n` is listed as a dependency instead.
It would be great to commit this patch to have it included in Beta 3 so
feel free to land as-is and we can handle the rest later.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/48154#comment:54>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list