I run code from https://github.com/vporton/test-nonexistent-canister:
$ dfx start --clean
(switch to another terminal)
$ make
…
(the string BBBBBBB
is output in another terminal)
$ find -name *.wasm
./.dfx/local/canisters/A/A.wasm
So, only A is compiled, B isn’t. Now I wonder why BBBBBBB
from not compiled B
was output?!
Below is the code for your reference:
dfx.json
:
{
"canisters": {
"A": {
"main": "src/A.mo",
"type": "motoko"
}
}
}
Makefile
:
.PHONY: run
run:
dfx deploy A
dfx ledger fabricate-cycles --amount 1000000000 --canister A
dfx canister call A init '()'
A.mo
:
import Cycles "mo:base/ExperimentalCycles";
import B "./B";
actor class A() {
public shared func init(): async () {
Cycles.add(1000_000_000_000);
ignore await B.B();
}
}
B.mo
:
import Debug "mo:base/Debug";
actor class B() {
Debug.print("BBBBBBB");
}