babel-plugin-lodash icon indicating copy to clipboard operation
babel-plugin-lodash copied to clipboard

Check for package key `module` in addition to main

Open dan-kez opened this issue 6 years ago • 2 comments

Hi all!

It would be fantastic to have the ability to configure what "mainFields" to resolve similar to webpack.

Right now I have a main field that points to lib/index.js. The lib directory is used when I publish to npm. However, internal to my monorepo I transpile my node_modules by using the module key in package.json. The key points to src/index.js.

The code in question is here: https://github.com/lodash/babel-plugin-lodash/blob/3f9c8e48ba66ed68132f7c1ef40b5e1e4c466d6c/src/ModuleCache.js#L19-L21

Happy to provide additional context!

dan-kez avatar Oct 16 '18 14:10 dan-kez

Hi @dan-kez!

Thanks for the suggestion. I'm open to a PR if you'd like to contribute!

jdalton avatar Oct 16 '18 14:10 jdalton

Awesome! I'll take a look this week and write something up

dan-kez avatar Oct 16 '18 15:10 dan-kez