Two-dimensional heterojunctions of transition-metal dichalcogenides1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15have great potential for application in low-power, high-performance and flexible electro-optical devices, such as tunnelling transistors5,6, light-emitting diodes2, 3, photodetectors2,4and photovoltaic cells7, 8. Although complex heterostructures have been fabricated via the van der Waals stacking of different two-dimensional materials2, 3, 4, 14, thein situfabrication of high-quality lateral heterostructures9,10,11,12,13,15with multiple junctions remains a challenge. Transition-metal-dichalcogenide lateral heterostructures have been synthesized via single-step9,11,12, two-step10, 13or multi-step growth processes15. However, these methods lack the flexibility to control,in situ, the growth of individual domains.In situsynthesis of multi-junction lateral heterostructures does not require multiple exchanges of sources or reactors, a limitation in previous approaches9,10,11,12,13,15as it exposes the edges to ambient contamination, compromises the homogeneity of domain size in periodic structures, and results in long processing times. Here we report a one-pot synthetic approach, using a single heterogeneous solid source, for the continuous fabrication of lateral multi-junction heterostructures consisting of monolayers of transition-metal dichalcogenides. The sequential formation of heterojunctions is achieved solely by changing the composition of the reactive gas environment in the presence of water vapour. This enables selective control of the water-induced oxidation16and volatilization17of each transition-metal precursor, as well as its nucleation on the substrate, leading to sequential edge-epitaxy of distinct transition-metal dichalcogenides. Photoluminescence maps confirm the sequential spatial modulation of the bandgap, and atomic-resolution images reveal defect-free lateral connectivity between the different transition-metal-dichalcogenide domains within a single crystal structure. Electrical transport measurements revealed diode-like responses across the junctions. Our new approach offers greater flexibility and control than previous methods for continuous growth of transition-metal-dichalcogenide-based multi-junction lateral heterostructures. These findings could be extended to other families of two-dimensional materials, and establish a foundation for the development of complex and atomically thin in-plane superlattices, devices and integrated circuits18.