我在Vue CLI项目的process.on
文件中使用节点的main.js
函数遇到了挑战。
我的文件中包含以下代码。
process.on("unhandledRejection",function(reason,promise){
console.log("Unhandled",reason,promise); // log all your errors,"unsuppressing" them.
throw reason; // optional,in case you want to treat these as errors
});
项目已构建,但是在浏览器中打开应用程序时,出现错误:
Uncaught TypeError: process.on is not a function
如何配置项目,以便可以使用Node的进程? 在这种情况下,我是否不了解NodeJS? 我有什么想念的吗? 感谢您的任何帮助。