A source XXX goes through an erasure channel whose output is ZZZ. The goal is to compress losslessly XXX when the compressor knows XXX and ZZZ and the decompressor knows ZZZ. We propose a universal algorithm based on context-tree weighting (CTW), parameterized by a memory-length parameter `. We show that if the erasure channel is stationary and memoryless, and XXX is stationary and ergodic, then the proposed algorithm achieves a compression rate of H(X0jX01 0` ;Z` ) bits per erasure.