         binary: binary
       )
 
-    source(size: size) = List.keyfind(sources, source, source(:source))
+    source(size: size, external: old_external) =
+      List.keyfind(sources, source, source(:source))
 
     new_source =
       source(

      end

    modules = prepend_or_merge(modules, module, module(:module), new_module, existing_module?)
    sources = prepend_or_merge(sources, source, source(:source), new_source, existing_source?)
    put_compiler_info({modules, structs, sources, pending_modules, pending_structs})
    :ok
  end

        runtime_references: runtime_references,
        compile_dispatches: compile_dispatches,
        runtime_dispatches: runtime_dispatches,
        external: external ++ old_external
      )

    old_struct = Map.get(structs, module)
