How-to
Load one country at a time
Use the original static paths or on-demand loaders.
Use the native API
import { loadSubdivisions } from "@johnmorrisdotca/kuni/load";
import prefectures from "@johnmorrisdotca/kuni/subdivisions/jp";
console.log((await loadSubdivisions("JP"))?.length,prefectures.length,prefectures[0].code);
console.log(await loadSubdivisions("XX"));47 47 JP-01
nullA fixed country import points to the same existing built file as the retained wildcard path. Default and named SUBDIVISIONS exports refer to the same native list. On-demand loading uses one country module; a host bundler can make its own chunk. This is module loading, not a live geographic-data API. Unsupported codes return null; valid countries with no subdivisions return an empty list.
Read subdivision facts separately
import { loadSubdivisionFacts } from "@johnmorrisdotca/kuni/subdivision-facts";
import facts from "@johnmorrisdotca/kuni/subdivision-facts/jp";
console.log((await loadSubdivisionFacts("JP"))?.length,facts[0].code);47 JP-01Keep the subdivision name record distinct from its facts. The catalogue names all 400 existing fixed resource paths. Wildcard imports remain available with their unchanged ESM/CommonJS targets.