This repository was archived by the owner on Sep 16, 2023. It is now read-only.

Description
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:
|
const pkgPath = path.join(moduleRoot, 'package.json'); |
|
const pkgMain = fs.existsSync(pkgPath) && require(pkgPath).main || 'index.js'; |
|
const mainPath = normalizePath(path.dirname(path.resolve(moduleRoot, pkgMain))); |
Happy to provide additional context!