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

WordPress Trac noreply at wordpress.org
Tue Mar 3 10:16:56 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:  needs-patch 2nd-opinion  |     Focuses:  javascript
-------------------------------------+-------------------------

Comment (by gziolo):

 I think I have an idea of how it all can be solved. The issue we encounter
 with the assets file generated is caused by the difference in version
 hashes generated for chunks. It works this way by design because it is
 calculated based on the content of the output files. In `production` mode
 you usually will have a different code than in `development` mode because
 we often branch code depending on the env (we extensively use development
 tools, logging to JS console in dev mode, etc).

 We already use different file names depending on env, see:
 https://github.com/WordPress/wordpress-
 develop/blob/master/tools/webpack/packages.js#L60-L63

 We should extend it for combined asset files and have one for
 `development` and one for `production`. They would be loaded
 conditionally, similar to how assets are registered. The only blocker is
 that the name for the output file is hardcoded in the webpack plugin so we
 need to allow some customization as proposed by @azaozz in
 https://github.com/WordPress/gutenberg/issues/20562.

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


More information about the wp-trac mailing list