Repository navigation
fix(svg): build on iOS without @nativescript/canvas - #180
Merged
Merged
Conversation
canvas-svg's iOS sources include "include/v8.h", but the package shipped no
V8 headers, so an app with only canvas-svg failed to build ('include/v8.h'
file not found). It only worked when @nativescript/canvas was installed too.
Ship the same NativeScriptV8 SwiftPM shim audio-context and canvas ship, with
a plugin nativescript.config.ts declaring it (the CLI dedupes the package
across plugins). As in canvas's build.xcconfig, also add Headers/include
itself to the search path, since the V8 headers include each other by bare
name (cppgc/common.h -> "v8config.h"), and build as C++20 for V8 14.9.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
triniwiz
added a commit
that referenced
this pull request
Oct 9, 2026
AudioModule.mm includes the runtime's Runtime.h, whose headers include V8
by bare name ("v8.h"), so an app with only audio-context failed to build
('v8.h' file not found). It only worked when @nativescript/canvas was
installed too, since canvas's build.xcconfig puts Headers/include on the
search path.
audio-context already ships the NativeScriptV8 SwiftPM shim; as in #180 for
canvas-svg, add the shim's Headers/include to the search path and build as
C++20 for V8 14.9.
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.
Problem
@nativescript/canvas-svgdoesn't build on iOS unless@nativescript/canvasis also installed:The SVG sources compile against the V8 headers, but only
canvas(andaudio-context) ship them, as theNativeScriptV8SwiftPM shim. Android isn't affected: its native libraries only link against the NativeScript runtime.Fix
NativeScriptV8shim (Package.swift, Headers, Sources) fromnativescript-v8/ascanvasandaudio-contextdo. A pluginnativescript.config.tsdeclares it, and the CLI dedupes the same-namedCanvasNativepackage across plugins.build.xcconfig: addHeaders/includeto the search path, as canvas'sbuild.xcconfigdoes, and build as C++20 for V8 14.9. The shim alone getsinclude/v8.hto resolve, but the V8 headers then include each other by bare name (cppgc/common.h→"v8config.h"). The flags use their own variable names, so the CLI's xcconfig merge appends them next to canvas's instead of dropping one.Testing
nx buildwasn't available in my checkout, so I assembled the package by hand (published 3.0.0-beta.3 plus this change's assets) and ran it in a NativeScript Vue app on the iPhone 17 Pro simulator, iOS 26.4:'include/v8.h' file not found'v8config.h' file not found@nativescript/canvas3.0.0-beta.3CanvasNativepackage, both plugins' header flags merged, no xcconfig conflictsAndroid with canvas-svg only builds as before.
Note
audio-contextships the shim but itsbuild.xcconfighas neither theHeaders/includeflag nor C++20, so it probably hits the samev8config.herror when it's installed without canvas. I haven't tested that.