[wp-trac] [WordPress Trac] #48154: Build Tools: Integrate DependencyExtractionWebpackPlugin in the JS build
WordPress Trac
noreply at wordpress.org
Tue Mar 3 17:26:41 UTC 2020
#48154: Build Tools: Integrate DependencyExtractionWebpackPlugin in the JS build
-------------------------------------+-------------------------
Reporter: gziolo | Owner: gziolo
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: 5.5
Component: Build/Test Tools | Version:
Severity: normal | Resolution:
Keywords: needs-patch 2nd-opinion | Focuses: javascript
-------------------------------------+-------------------------
Changes (by azaozz):
* component: Script Loader => Build/Test Tools
* milestone: 5.4 => 5.5
Comment:
Replying to [comment:72 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).
Yeah, for now mostly the version strings (the hashes) are different, but
some packages might have different dependencies too. And that may be more
common in the future.
> We should extend it for combined asset files and have one for
`development` and one for `production`.
This is pretty much how it works now, but is not very straightforward,
it's hard to "see" it. The dev version of `script-loader-packages.php` is
in /src and is committed. The production version is generated every time
`npm run build` (or `grunt build`) is run.
> 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.
Right, we can change the name depending on whether Webpack runs in
production or development mode, and output the file to the right place.
This ticket will need some more work (and testing). As it is for "build
tools" at this point, and there is a lot of background in the comments,
lets continue during 5.5.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/48154#comment:73>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list