请问Creator 3.1和electron如何集成?

我现在有个electron做的游戏大厅和creator3.1做的web-mobile子游戏。
请问游戏大厅和子游戏如何传递消息?
目前我在子游戏里
import { ipcRenderer} from ‘electron’;
ipcRenderer.invoke(‘close-app’);
会报错:
Error: Unable to resolve bare specifier ‘fs’ from http://localhost:7456/scripting/x/mods/file/D:/Codes/Electron/node_modules/electron/index.js (SystemJS Error#8 https://git.io/JvFET#8)
at throwUnresolved (resolve.js:12)
at SystemJS.systemJSPrototype.resolve (resolve.js:8)
at SystemJS.systemJSPrototype.resolve (named-register.js:45)
at system-core.js:145
at Array.map ()
at system-core.js:143

等了好几天0回复,只好想了个临时方案先顶着。
electron端开个ws服务,cocos这边用ws收发消息。
如有更简洁的方案请大佬们不吝指教。