I found an issue when importing classes that in turn import icon variables. This fails in 0.6.7, but works in 0.6.6.
The errors only occur when I use imports from c.d2 as icons. I tried changing icon: to label: in b.d2 and it worked. I tried importing everything from a.d2 and it works too, but this doesn't really fit my use case.
I am not sure but maybe it is something related to #2066, because the error message indicates that a remote image has been detected as a local image. But I don't know why this happens with this specific importing structure.
How to replicate
I have the following files in the same directory:
# a.d2 (the file to compile)
...@b.d2
a1: {
class: Ecs
}
a2: {
class: Lambda
}
a1 -> a2
# b.d2 (the file with the classes)
...@c.d2
classes: {
Ecs: {
shape: "circle"
icon: ${icons.ecs}
}
Lambda: {
shape: "hexagon"
icon: ${icons.lambda}
}
}
# c.d2 (the file with the icons)
vars: {
icons: {
ecs: "https://icons.terrastruct.com/aws%2FCompute%2FAmazon-Elastic-Container-Service.svg"
lambda: "https://icons.terrastruct.com/aws%2FCompute%2FAWS-Lambda.svg"
}
}
Depending on the version of D2 that I'm using, the behavior is different.
With version 0.6.6 I get the following diagram:
With version 0.6.7 I get the following errors:
Errors
err: failed to bundle .: read .: is a directory
err: failed to compile -: failed to bundle local images: [.]
The problem
I found an issue when importing classes that in turn import icon variables. This fails in 0.6.7, but works in 0.6.6.
The errors only occur when I use imports from
c.d2
as icons. I tried changingicon:
tolabel:
inb.d2
and it worked. I tried importing everything froma.d2
and it works too, but this doesn't really fit my use case.I am not sure but maybe it is something related to #2066, because the error message indicates that a remote image has been detected as a local image. But I don't know why this happens with this specific importing structure.
How to replicate
I have the following files in the same directory:
Depending on the version of D2 that I'm using, the behavior is different.
0.6.6
I get the following diagram:0.6.7
I get the following errors:Set up