[WCM] Encore updates for Webpack 4 #10322
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Phew! The next (unreleased) version of Webpack Encore (will be 0.21.0) that supports Webpack 4 will contain a few minor changes, that have major implications on the documentation. Ultimately, I think the experience will be easier for users :). The 3 big changes are:
In all cases, people should use the new WebpackEncoreBundle and its 2 new Twig functions -
encore_entry_script_tags()
andencore_entry_link_tags()
to render theirscript
andlink
tags.In earlier versions, an extra
manifest.js
file was output when usingcreatedSharedEntry()
. But now, a newruntime.js
file is always output. But, because of theencore_entry_script_tags()
shortcut... that's just rendered for you automatically.createSharedEntry()
is no longer hipster ;). This is from changes in Webpack. A newer, and better "split chunks" feature replaces it... which (other than changing how existing users think), is much simpler. Basically, the user does nothing... except callencore_entry_script_tags()
. But, when this feature is enabled, the final.js
and.css
files may be split into multiple files. And so, theencore_entry_script_tags()
(and also the link version) may render multiple script tags. This all happens automatically.TODO: Wait for the bundle to be tagged, then test the new recipe (symfony/recipes#458) and code through some of the docs to catch any mistakes (due to so many changes).
Merging into 4.1 TODOS
web/
topublic/
Cheers!