How to properly run a Rails app inside Electron?

守給你的承諾、 提交于 2019-12-04 15:49:10

For future reference, the correct way to solve this is to set the "node-integration" option on BrowserWindow to false, like so:

var app = require ('app')
var BrowserWindow = require ('browser-window')
app.on('ready', function(){
    var mainWindow = new BrowserWindow({
        width:1115,
        height:945,
        "node-integration": false
    })
    mainWindow.loadUrl('http://my-app-at-heroku.herokuapp.com')
})

Source: https://github.com/atom/electron/issues/254#issuecomment-82322963

I found out the solution.

In my Rails app, I had to include the following in the header:

<script type="text/javascript">
  window.module = undefined;
  window.require = undefined;
</script>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!