Running code from a not compiled WASM? (I'm confused.)

I run code from

$ dfx start --clean
(switch to another terminal)
$ make

(the string BBBBBBB is output in another terminal)
$ find -name *.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:


  "canisters": {
    "A": {
      "main": "src/",
      "type": "motoko"


.PHONY: run
	dfx deploy A
	dfx ledger fabricate-cycles --amount 1000000000 --canister A
	dfx canister call A init '()'

import Cycles "mo:base/ExperimentalCycles";
import B "./B";

actor class A() {
    public shared func init(): async () {
        ignore await B.B();

import Debug "mo:base/Debug";

actor class B() {

A imports actor class B and instantiates it, which leads to the Debug.print in B being executed

Although dfx doesn’t compile B explicitly, the compilation of A requires the compilation of dependency B. The wasm binary for B is actually included directly in the wasm binary for A, so that A can deploy the code for B programmatically, whenever a new instance of class B Is created.