[wp-trac] [WordPress Trac] #48154: Build Tools: Integrate DependencyExtractionWebpackPlugin in the JS build

WordPress Trac noreply at wordpress.org
Sat Feb 22 08:17:10 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:  2nd-opinion has-patch  |     Focuses:  javascript
-----------------------------------+-------------------------
Changes (by azaozz):

 * keywords:  2nd-opinion needs-patch => 2nd-opinion has-patch


Comment:

 @gziolo yes, seems to be working well. Thanks! If you have a chance
 perhaps give it a try.

 In 48154.diff:
 - Update dependency-extraction-webpack-plugin to 2.3.0.
 - 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`.
 - Tweak `wp_default_packages_scripts()` to include and use the new file.

 This seems to be working here. Running only `npm run build` followed by
 `phpunit`, running grunt directly, new/clean checkout of trunk, etc.
 Please test! :)

 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?

 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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48154#comment:49>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list