Disable implicit serving of the source files #551
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.
Migration Instructions
Paths like
/src/somefile.png
used to be served in development, but only by accident. They never worked in production builds. Since 0.4.0, we don’t serve static files by default in development anymore either. This removes a dangerous inconsistency that we never intentionally supported.If you need a static file to be part for the build, import it from JavaScript and you will get its filename. This ensures it gets included into the production build as well, and its filename contains the content hash.
If you used static files with
<link href>
, read this new guide on how to make sure these files get included into the builds. For example, you can replace<link href="/src/favicons/favicon-32.png">
with<link href="./src/favicons/favicon-32.png">
, and then Webpack will recognize it and include it into the build.If you referenced some other files from
index.html
, please file an issue to discuss your use case. In the meantime, you can serve them from a separate static server until your use case is supported.Fixes #503 (it was never intentionally supported).
Supersedes #226 (I think there is not enough proof that this feature is necessary after #428).
Documents #428.
I understand this will be somewhat controversial because people might rely on this, but if they do, their production builds are already broken right now. This brings our features to consistency and documents the escape hatch that I believe removes the need for #226.
Justification in the comment: