lodash / babel-plugin-lodash

Modular Lodash builds without the hassle.
Other
1.96k stars 91 forks source link

Check for package key `module` in addition to main #224

Open dan-kez opened 5 years ago

dan-kez commented 5 years ago

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!

jdalton commented 5 years ago

Hi @dan-kez!

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

dan-kez commented 5 years ago

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