WebStorm 自动导入 - "require" 而不是 "import from"

WebStorm Auto import - "require" instead of "import from"

在 Node.js 项目上工作 当我的 Node.js 不支持导入语句时,我得到了使用 ES6 导入的建议 (Alt + Enter)。我可以添加使用 require 的建议吗?自动导入节省了很多时间...

manipulateName 方法定义:

const manipulateName = (layout, method) => {
    layout.name = method(layout.name);
    return layout;
}

和...

module.exports = {
    manipulateName,
 ...
}

请确保为您的项目启用了 Node.js Core 库(首选项 | 语言和框架 | Node.js 和 NPM , Node.js 核心库).

参见缺少 require() 语句 检查(首选项 | 编辑器 | InspectionsJavaScript | Node.js)描述:

Checks that all modules are referenced through "require()".
Suggests inserting the "require()" call.
Works only in files in the scope of "Node.js Core" JavaScript library.

Webstorm 2019.2.
就我而言,我尝试启用 "Coding assistance for Node.js" 但发生了以下情况:
检查 "Coding assistance for Node.js" --> 确定 --> 重新打开 "Node.js and NPM" --> 未检查编码辅助。

我做了以下事情:
1. 帮助 --> 查找操作 --> 注册表 --> 搜索 "nodejs.core.library.use.typings" --> 禁用它。
2. 文件 --> "Invalidate and Restart"
3. 转到终端 --> 输入:

  /usr/local/bin/node /usr/local/lib/node_modules/npm/bin/npm-cli.js install @types/node --ignore-scripts

4。设置 --> "Node.js and NPM" --> 检查 "Coding Assistance for Node.js"

已解决! 还要检查 Jetbrains Issue