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.
We've been running into problems when porting older stories where some images have been exported as static assets, but contain the text of a JS module with an import value of the original image page. These appear in our output as little white squares (in the case of PNGs). @phocks discovered that it is a side-effect of us using some deprecated asset loaders in the Webpack 5 environment.
Webpack 5 now has built-in support for loading assets which previously required the use of
file-loader,url-loaderandraw-loader. I've updated the internal Webpack config rules to leverage this feature, and it's solved the issues we were seeing (and is probably more future-proof anyway).Webpack allows the definition of either
asset/resourceandasset/inlinetypes to decide whether assets are output as files (with hashed names) or inlined into the JS/CSS (as data-uris). We previously output all but images as resouces and split images between the two strategies on a 10kb threshold. Webpack takes care of this entire thing by giving us theassettype, and automatically selects based on an 8kb threshold (which I think is acceptable).We were also using the
html-loaderpackage to import.htmlfiles as raw text. This is now handled by the new webpackasset/sourcetype, sohtml-loaderhas also been removed. The ability to import other arbitrary file types as strings has also been enabled (by adding?rawto your import path). SVG files can also now opt-into raw loading, rather than being handled as an asset (we sometimes like to use them as innerHTML).