我不能在单个 .js 文件中 运行,如果有 import xxx from xxx 的话

I can not run in the single `.js` file, if there is the `import xxx from xxx`

我不能运行在单个.js文件中,如果有import xxx from xxx

我使用单个文件调试导入的 ts_config,我如何在 WebStorm 中执行此操作?


EDIT-1

配置选项如下:

告诉我该怎么做?

您使用的是旧版本的 nodejs,并且 v6.6 不支持 import 关键字。请为 import 关键字使用版本 8 或更高版本,而不使用任何像 babel 这样的转译器。

您尝试使用的功能是 ES Modules 规范的一部分。

但是,从版本 v9.9.0 开始,ES ModulesNode.js 中不稳定,不应在生产中使用。 此功能正在开发中,预计 stable-released 和 Node.js v10.0.0

现在,您可以:

const ts_config = require('./tsconfig.json);

您要导出 tsConfig 吗?

export default
{
  // json here...
}