Fixes #3186

Moves call to `require.resolve` inside a conditional as suggested here (jashkenas/coffee-script#3107) in order to resolve #3186.