Wait, what language is this?
MagicHash, 30 bytes



x=1
y#a=2
x#a=1
main=print$x#x


-XMagicHash outputs 1, -XNoMagicHash outputs 2

MagicHash allows variable names to terminate in a #. Therefore with the extension, this defines two functions y# and x# which each take a value and return a constant 2, or 1. x#x will return 1 (because it is x# applied to 1)

Without the extension, this defines one function # which takes two arguments and returns 2. The x#a=1 is a pattern that never gets reached. Then x#x is 1#1, which returns 2.