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.
What kind of change does this PR introduce?
Bug fix / refactoring for future use
Did you add tests for your changes?
Yes
Summary
Closes #1675
In short, the
push-manifest.jsonoutput had hard-coded expectations that caused two problems in the linked issue:"undefined"entry in thepush-manifestThis fixes both issues by using
webpack-manifest-plugin(Webpack really should make this part of core, extremely useful to expose this info to other plugins).This plugin provides a map output assets that allows us to keep our expectation about a
bundle.cssorroute-home.jsexisting, but allows users to still customize the actual output. For example, the following config:...would create the following manifest:
{ "/bundle.css": "/foo/styles/foobar.css", "/bundle.js": "/foo/bundle.29bec.esm.js", "/bundle.js.map": "/foo/bundle.29bec.esm.js.map", }Should allow users to customize output names as they wish without it interfering with any assumptions we've made about output.
In the future we might be able to make greater use of this and move away from asset path concatenation like the following:
preact-cli/packages/cli/lib/resources/head-end.ejs
Line 1 in a56d904
However, for now, I'd hesitate to do that as this might break some configs. Better to wait for a major.
Still, it should allow for much more robust targeting of output assets as it won't fall to pieces if a user makes configuration changes.
Does this PR introduce a breaking change?
No