The Shadow Within was written before the Technomage Trilogy, and is also set before it. (The earlier novel takes place a couple of years before season 1, in the period surrounding the Icarus expedition to an unidentified planet that turns out to be Z''ha'dum. The first Technomage book begins in 2258, if memory serves, and ends just before the Exodus of the Mages in 2259.)
But the earlier novel isn't really a prequel per se. Obviously at the time it was written (when the series was still in production) Jeanne Cavelos had no inlkling that she would later be writing a trilogy to fill out parts of the story not shown in the series, and which would weave in and out of the on-screen stories. She did carry some characters over from the earlier book to the later ones, including some of the ones she'd invented for Shadow, but mostly that was because they were the people who were involved in the two sets of events she was narrating in the "real" history of the B5 universe. The Tehcnomages themselves do not appear in [ii]Shadow[/i], so there aren't any direct spoilers there. I recommend reading Shadow first because it gives you more background on Morden and the Shadows and Anna Sheridan. But all the essential information is given in the trilogy, so you don't have to read the earlier book first.
Hope this helps.
Joe