import-js icon indicating copy to clipboard operation
import-js copied to clipboard

Lodash alias doesn't work

Open LandonSchropp opened this issue 5 years ago • 2 comments

I'm trying to get ImportJS to automatically import Lodash for me. Here's what my config looks like:

module.exports = {
  aliases: {
    _: "lodash",
  },
  danglingCommas: false,
  maxLineLength: 100
};

When I run ImportJS on a file containing this:

console.log(_.map([ 1, 2, 3 ], x => x * x));

Nothing seems to happen. What am I missing?

Thanks!

LandonSchropp avatar Oct 04 '20 22:10 LandonSchropp

Hi @LandonSchropp! I can confirm this isn't working in my case either. A workaround seems to be if you specify the full path to the lodash module. This works for me:

module.exports = {
  aliases: {
    _: "node_modules/lodash",
  }
};

trotzig avatar Oct 05 '20 07:10 trotzig

@trotzig Thanks for the workaround! That seems to get me past the issue. 🙂

LandonSchropp avatar Oct 07 '20 18:10 LandonSchropp

Closing this issue as it has become stale. If you feel we should look more into this, please feel free to reopen it. Thanks.

mikabytes avatar Jan 27 '24 09:01 mikabytes