fix: Remove custom image rules#145
Merged
g-elwell merged 3 commits intorelease/2.0.0from May 23, 2025
Merged
Conversation
This was referenced May 23, 2025
13 tasks
g-elwell
added a commit
that referenced
this pull request
Oct 16, 2025
* fix: initial testing of webpack config import * chore: bump version * chore: make beta version * fix: remove extrenuous new line * fix: remove config that is nolonger required * chore: bump version * chore: clean up build assets * chore: update @wordpress/scripts to latest * chore: rebuild package lock * chore: rebuild package lock * 2.0.0-alpha.2 * fix: block copy context and target * 2.0.0-alpha.3 * fix: allow for big bite block structure builds * chore: version bump * fix: ensure block and non-block entrypoints can be built together * fix: revert changes to entrypoint detection the entrypoint detection should not care if block entrypoints are present, as these are handled by wp-scripts. it can continue to throw an error provided we catch this in the correct location * fix: catch errors if non-block entrypoints are not found * test: update webpack and file system mocks * test: added example to cover scenario with both * fix: add seperate example css for frontend * fix: remove css-loader and minification plugin from rules * chore: remove css-loader and mini-css-extract-plugin packages * feat: add initial support for script modules * fix: re-add eslint and stylelint plugins * feat: use wp-scripts eslint config * chore: remove unused plugins * fix: move import/resolver to correct location in config * fix: remove unneeded rule * fix: extend wordpress babel config * fix: re-add extraneous deps rule * fix: prevent re-processing js and ts * chore: remove unused dependencies * chore: rebuild package-lock * chore: update node version * fix: correct file name and format of eslint-config-func * docs: explain entrypoint and block directory structure * fix: correctly set WP src path * chore: update wp packages to latest * chore: update sass-loader * chore: bump version * chore: version bump * fix: adds context path assignment to webpack configs * chore: remove debugging * fix: reassign project path to env var as may be required for single project builds * fix: set WP_SOURCE_PATH env var before requiring wp-scripts webpack config to allow CSS/JS to build * fix: ensure WP_SOURCE_PATH is always a relative path * fix: Remove custom image rules (#145) * fix: remove custom image rules * test: update svg import syntax in example site * chore: version bump * Set correct path for script modules (#146) * fix: ensure script module config uses correct source path for project * chore: version bump * feat: add eslint import/order rule (#147) * fix: add stylelint use logical properties rule (#148) * chore: rename dist directory to build to align with wp-scripts (#150) * chore: update example site code to fix eslint issues * test: add integration tests * chore: apply eslint to source and fix issues * fix: resolve eslint issues relating to global vars * chore: add missing deps to package json * chore: destructure global inside of function to avoid failing test * chore: remove integration test file * Revert "chore: remove integration test file" This reverts commit 2743aed. * ci: run only cli tests in CI * fix: remove static config interfering with dynamic aliases * docs: correct inline links to avoid pointing to wiki * fix: explicitly use prettier and eslint configs * test: broaden string matching to prevent terminal formatting issues * chore: update minimum node version to 22 * docs: update working with your assets doc * chore: version bump 2.0.0 * docs: add upgrade guide from v1 --------- Co-authored-by: Paul Taylor <paul@bigbite.net> Co-authored-by: Paul Taylor <ampersarnie@users.noreply.github.com> Co-authored-by: Paul Taylor <paul.taylor@hey.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Removes custom image loader(s) in favour of those provided by wp-scripts
An issue was reported #144 where font files were being processed incorrectly, this was due to the combination of both wp-scripts loaders and our own being applied. Having audited what our loaders were doing, it's safe to remove them.
Fonts and images (png|woff|woff2|eot|ttf|gif|jpg|jpeg)
These were being copied by file-loader previously, will now be handled by wp-scripts which includes a couple of additional file types too:
dist/imagesdist/fontsIt doesn't matter where you're storing the files in your project, referencing them in JS/(S)CSS will cause webpack to find them and copy the files to
distwith hashes added to their names.SVGs
wp-scripts covers using SVGs both as files/resources and in React as components, although this differs from how we have been using it previously:
Import SVG as component
Syntax is different
Previous:
import SVG from '../logo.svg';wp-scripts:
import { ReactComponent as SVG } from '../logo.svg';Import SVG as url
Syntax is different - the SVG isn't copied to
dist, it's base64 encoded. Tested working in both JS and (S)CSS.Previous:
import svg from '../svg-file.svg?url';wp-scripts:
import svg from '../svg-file.svg';How to test
I've tested the reported issue is resolved by this change by following the steps outlined there. The font file is copied to
distcorrectly and referenced correctly in the generated CSS file.