I think my understanding is that when you sell your ship you get 90% of the value back. So if you sell with all your modules you get 90% of the value back on them too.
But if you strip your modules and downgrade everything as much as you can you can get full value back on them.
You'll still take the 90% hit on your base ship sale though.