How do I use Rust with Wasm with multiple Rust files?

I'm using wasm-pack build --target web.
My project has a main.rs and a lib.rs. I've got a function in my lib.rs which I'm invoking in main.rs. But I'm unsure where to put the #[wasm_bindgen] macro and how I import this function into my js file.

You might want to go through the Conway's Game of Life tutorial from the wasm-bindgen docs. It explains a lot about how #[wasm_bindgen] attribute is used and the process of integrating a Rust library into a JavaScript application.