0
votes

I'm creating an Electron App using React. It successfully plays flash on the dev environment but fails to do so in production. In my electron.js file (main file) I've added an if-else to locate the dll to a different folder when electron produces a build.

In the electron.js, I use this line to have the dll included when playing flash.

switch (process.platform) {
  case 'win32':
    pluginName = 'plugins/pepperflashplugin.dll'
    break
  case 'darwin':
    pluginName = 'plugins/PepperFlashPlayer.plugin'
    break
  case 'linux':
    pluginName = 'plugins/libpepflashplayer.so'
    break
  default:
    break
}
    isDev ? app.commandLine.appendSwitch('ppapi-flash-path', path.join(__dirname, pluginName)) :
      app.commandLine.appendSwitch('ppapi-flash-path', 'resources/extraResources', pluginName);

Here's the build field of my package.json

  "build": {
    "appId": "com.fp.uav",
    "files": [
      "build/",
      "node_modules/**/*"
    ],
    "extraResources": [
      {
        "from": "public/plugins/",
        "to": "extraResources",
        "filter": [
          "**/*"
        ]
      }
    ],
    "win": {
      "icon": "public/assets/UAV.ico"
    }
  }

What happens is I build the project then electron-builder use the files in my build folder then it will put the production build in the dist.

Here's my Folder structure if it helps. enter image description here

Any help is appreciated. Thanks!

1

1 Answers

0
votes

I've added this statement into my main.js or in this case electron.js

app.commandLine.appendSwitch('no-sandbox');

Which was stated on a different plugin but had the same issue where the production build says "Couldn't load plugin" here:

https://github.com/Kagami/mpv.js/issues/51