如何将node.js child_process导入Ember Electron应用程序



我正在尝试将node.js应用程序转换为Ember Electron应用程序。在node.js应用程序中,我使用:

const spawn = require('child_process').spawnSync;

但不知道如何将"child_process"导入Ember Electron应用程序。尝试过:

import { child_process } from 'child_process'; // blows up: requireNode is not a function

以及:

import requireModule from 'ember-require-module'; 
const child_process = requireModule('child_process'); // does not find it

也许在Ember Electron应用程序中使用node.js是一种错误的方法?任何想法都值得赞赏。谢谢

对不起,文档说明了如何执行:

const spawn=requireNode('child_process'(.spawnSync;

https://ember-electron.js.org/docs/guides/development-and-debugging#require-和requirenode-

而且效果非常好。

最新更新