electron-push-receiver icon indicating copy to clipboard operation
electron-push-receiver copied to clipboard

trouble with ElectronForge webpack plugin

Open louisparks-sta opened this issue 4 years ago • 1 comments

Hi, My project uses ElectronForge (Webpack, Typescript) boilerplate project. When I try to start the notification service I get the following error and it doesn't start.

Error: ENOENT: no such file or directory, open '/Users/xxx/xxxxx/.webpack/main/native_modules/android_checkin.proto'

If I modify loadProtoFile() in the base push_receiver module to load the android_checkin.proto explicitly webpack picks up this resources.

push-receiver/src/gcn/index.js protobuf.load(path.join(__dirname, 'android_checkin.proto'))

any hints to get this working with webpack without module code modifications are appreciated.

louisparks-sta avatar Feb 28 '21 18:02 louisparks-sta

@louisparks-sta

I was able to fix it using CopyWebpackPlugin.

// webpack.config.js

const path = require('path')
const CopyWebpackPlugin = require('copy-webpack-plugin')

module.exports = {
  plugins: [
    new CopyWebpackPlugin({
      patterns: [
        {
          from: path.resolve('./node_modules/push-receiver/src/gcm/android_checkin.proto'),
          to: path.resolve('./.webpack/main/native_modules/android_checkin.proto'),
        },
      ],
    }),
   ],
}

moneychaudhary avatar Jul 01 '21 10:07 moneychaudhary