electronはピットのremote of undefinedの解決を踏みます。
以前のプロジェクトは、electronのremoteを引用して直接

これまでのバージョンでは、electronのremoteモジュールを使用する場合、メインプロセスのウィンドウに

一方、メインプロセスにおいては、Remoteモジュールを開くためにwebPreferences構成パラメータ
ここで、electron踏みつけられたremote of undefinedの解決に関する記事を紹介します。もっと関連するelectron remote of undefinedの内容は以前の文章を検索してください。または下記の関連記事を引き続きご覧ください。これからもよろしくお願いします。
electron.remote
を呼び出して使ってもいいですが、最近はelectronを使って頻繁にエラーを報告していますか?ピットを踏んでからすぐに公式文書を確認しましたが、electronは更新されましたか?案の定、electron 10では、enabeleRemotemoduleのデフォルトはfalseとして修正されています。私たちは手動でtrueに変更する必要があります。
これまでのバージョンでは、electronのremoteモジュールを使用する場合、メインプロセスのウィンドウに
enableRemoteModule:true
パラメータを追加する必要はなく、remoteモジュールを呼び出すことができますが、electron 10では、モジュールを呼び出すためにパラメータを追加する必要があります。
// electron
let electron = require('electron')
// remote
let remote = electron.remote
// remote
console.log(remote)
パラメータが追加されていない前にエラーが発生します。
一方、メインプロセスにおいては、Remoteモジュールを開くためにwebPreferences構成パラメータ
enableRemoteModule:true
を必要とし、レンダリングプロセスにおいてメインプロセスの方法を呼び出すことができ、mianWindowに対して構成する必要がある。
mainWindow = new BrowserWindow({
width:600,
height:800,
/* Node */
webPreferences:{
nodeIntegration:true,
enableRemoteModule:true
}
})
問題が解決され、ピットを踏んだ。ここで、electron踏みつけられたremote of undefinedの解決に関する記事を紹介します。もっと関連するelectron remote of undefinedの内容は以前の文章を検索してください。または下記の関連記事を引き続きご覧ください。これからもよろしくお願いします。