Dune can't find my module Lex

I have been using ocamlbuild but am trying to switch to Dune. I’m getting the error message “Error: Unbound module Lex” even though the source file for my lexer, lex.mll, is in the same directory as the .ml files for my compiler, which Dune finds. Do I need to tell Dune how to deal with a .mll file?

Yes indeed !
You can use (ocamllex lex) in your dune file, see here: Stanza reference — dune documentation