Node.js 错误\u不支持\u目录\u导入

Node.js 错误\u不支持\u目录\u导入,node.js,Node.js,我有以下文件夹和文件: node/ modulea/ package.json dist/ index.js test/ test.js modulea/package.json包含: { "name": "modulea", "main": "./dist/index.js",

我有以下文件夹和文件:

   node/
       modulea/
           package.json
           dist/
              index.js
       test/
           test.js
modulea/package.json
包含:

{
  "name": "modulea",
  "main": "./dist/index.js",
  "exports": "./dist/index.js",
  "type": "module"
}
const msg  = "This is the default export.";
export default msg;
import msg from "../modulea";
console.log(msg);
/modulea/index.js
包含:

{
  "name": "modulea",
  "main": "./dist/index.js",
  "exports": "./dist/index.js",
  "type": "module"
}
const msg  = "This is the default export.";
export default msg;
import msg from "../modulea";
console.log(msg);
test/test.js
包含:

{
  "name": "modulea",
  "main": "./dist/index.js",
  "exports": "./dist/index.js",
  "type": "module"
}
const msg  = "This is the default export.";
export default msg;
import msg from "../modulea";
console.log(msg);
上述结果导致
ERR\u UNSUPPORTED\u DIR\u IMPORT Directory IMPORT'/module/a'不支持解析从/test.js导入的ES模块,尽管package.json中的
exports
属性指向实际模块文件

如果我使用
从“./modulea/dist/index.js”
导入消息,它就会工作

有没有一种方法可以使导入工作的简短化