Should main always point to a common js file when using conditional exports (require and import) in your package.json?

Viewed 19

In this snippet example from node docs why is the main field pointing to a common js file and not a ./main-module.js? I thought because "type": "module"you are signifying that the source code is ES modules so should main point to ./main-require.cjs?

// package.json
{
  "main": "./main-require.cjs",
  "exports": {
    "import": "./main-module.js",
    "require": "./main-require.cjs"
  },
  "type": "module"
}
0 Answers
Related