Repository navigation
feat(snap-networks-utils): enable bundling .svgs into networks utils - #423
Merged
Merged
Conversation
Julink-eth
had a problem deploying
to
default-branch
October 7, 2026 11:42 — with
GitHub Actions
Failure
|
mikesposito
approved these changes
Oct 8, 2026
| "build:all": "ts-bridge --project tsconfig.build.json --verbose --clean", | ||
| "build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references && yarn build:assets", | ||
| "build:all": "ts-bridge --project tsconfig.build.json --verbose --clean && yarn build:assets", | ||
| "build:assets": "rsync -a --prune-empty-dirs --include='*/' --include='*.svg' --exclude='*' src/ dist/", |
Member
There was a problem hiding this comment.
nit: we may have to come back at this at some point, as rsync does not work on Windows
Contributor
Author
There was a problem hiding this comment.
Yes it only works on IOS/Ubuntu it's good for now agreed.
4 tasks
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.



Explanation
@metamask/snap-networks-utilscould not import.svgfiles the way the snaps do (import icon from './icon.svg'), because unlikemm-snap-built snaps, the library build did nothing with them. This forced the sharedAssetfallback icon into an inlineQUESTION_MARK_SVGstring (#418).This PR makes
.svgimports work in the library:buildandbuild:allnow chain a newbuild:assetsscript that copiessrc/**/*.svgintodist/as-is.ts-bridgekeeps the imports in its output, andmm-snap's webpack config already turns.svgimports into their file contents, so a snap bundling the library inlines the markup exactly like its own SVGs. (Verified end to end with a temporary.svg: the library build copies it, the library tests see the real markup, and the Stellar bundle contains the inlined SVG.)jest.svg-transformer.jsmoved to the repo root from Solana, which previously had the only copy. Solana now points at the shared file; its behavior is unchanged because itsmoduleNameMapperstub already takes precedence over the transform.yarn.config.cjsrequired librarybuild/build:allscripts to match thets-bridgecommand exactly, rejecting the chained copy step. The constraint now requires the script to start with thets-bridgecommand, reusing the existingexpectWorkspaceScriptStartsWithhelper that snaps already follow, so other commands may be chained after it.One caveat, documented in the README and changelog: the published package now requires a bundler that loads
.svgfiles as source (e.g.mm-snap), since plain Node would fail to resolve the import. All current consumers are snaps, which is fine.References
Checklist