sdk
sdk copied to clipboard
Building frontend activates `moc`
Something is wrong.
I see in the terminal:
$ dfx deploy frontend
...
Building frontend...
and in the same time have 100% (one core) allocated to moc
process.
How is compiling with .moc
related to the frontend? At least, why does this building takes enormous time?
In a default project, the frontend has a dependency on the backend. The call may be to moc --print-deps
while building the dependencies graph.
"frontend": {
"dependencies": [
"backend"
],
But it seems to happen after backend canisters are already compiled! First it produces some backend warnings and only then starts time-consuming Building frontend...
. That's weird.
WARN: .mops/[email protected]/src/Principal.mo:80.20-80.32: warning [M0154], field append is deprecated:
`Array.append` copies its arguments and has linear complexity;
WARN: .mops/[email protected]/src/Principal.mo:80.20-80.32: warning [M0154], field append is deprecated:
`Array.append` copies its arguments and has linear complexity;
Executing: cargo build --target wasm32-unknown-unknown --release -p ic_eth --locked
Finished release [optimized] target(s) in 0.20s
Building frontend...
{
"canisters": {
"main": {
"main": "src/backend/main.mo",
"type": "motoko",
"dependencies": [
"order",
"payments",
"personhood",
"CanDBIndex",
"NacDBIndex",
"internet_identity",
"ic_eth"
]
},
"order": {
"main": "src/backend/order.mo",
"type": "motoko"
},
"personhood": {
"main": "src/backend/personhood.mo",
"type": "motoko",
"dependencies": ["ic_eth", "CanDBIndex"]
},
"frontend": {
"frontend": {
"entrypoint": "src/frontend/src/index.html"
},
"dependencies": [
"personhood"
],
"source": [
"src/frontend/assets",
"dist/frontend/"
],
"type": "assets"
},
"payments": {
"main": "src/backend/payments.mo",
"type": "motoko",
"dependencies": [
"pst"
]
},
"pst": {
"main": "src/backend/pst.mo",
"type": "motoko"
},
"CanDBIndex": {
"main": "src/storage/CanDBIndex.mo",
"type": "motoko",
"dependencies": ["ic_eth"]
},
"NacDBIndex": {
"main": "src/storage/NacDBIndex.mo",
"type": "motoko",
"dependencies": ["ic_eth"]
},
"CanDBPartition": {
"main": "src/storage/CanDBPartition.mo",
"type": "motoko",
"dependencies": ["ic_eth"]
},
"NacDBPartition": {
"main": "src/storage/NacDBPartition.mo",
"type": "motoko",
"dependencies": ["ic_eth"]
},
"ic_eth": {
"type": "rust",
"candid": "src/ic_eth/ic_eth.did",
"package": "ic_eth"
},
"internet_identity": {
"type": "custom",
"candid": "https://github.com/dfinity/internet-identity/releases/latest/download/internet_identity.did",
"wasm": "https://github.com/dfinity/internet-identity/releases/latest/download/internet_identity_dev.wasm.gz",
"shrink": false,
"remote": {
"candid": "internet_identity.did",
"id": {
"ic": "rdmx6-jaaaa-aaaaa-aaadq-cai"
}
}
}
},
"ic_eth": {
"type": "rust",
"candid": "src/ic_eth/ic_eth.did",
"package": "ic_eth"
},
"defaults": {
"build": {
"args": "-fshared-code --actor-idl .dfx/local/lsp",
"packtool": "mops sources"
}
},
"output_env_file": ".env",
"version": 1,
"networks": {
"local": {
"bind": "localhost:8000",
"type": "ephemeral"
}
}
}
Right, there is a bug in the prompt. When it shows Building frontend...
, it's actually still building backend. You can reproduce this by adding a syntax error in the backend code. The syntax error will show after Building frontend...
.