Replacing text in js files during build

I am very new to the dojo build system, and am just starting the process of learning how it works. I have read through most of the guides, but have not found what I was looking for. Is there a way to detect and replace text during the build process? In my js files I am pointing to url endpoints for ajax requests on my dev server, but I need to point to the production server once built. Is there a way to do this in the build system?

The way we do it is by having a preferences.js file containing the dev server url. once we move to production we just make a copy and replace the server name