MatthieuLemoine / electron-push-receiver

A module to bring Web Push support to Electron allowing it to receive notifications from Firebase Cloud Messaging (FCM).

Home Page:https://medium.com/@MatthieuLemoine/my-journey-to-bring-web-push-support-to-node-and-electron-ce70eea1c0b0

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

trouble with ElectronForge webpack plugin

louisparks-sta opened this issue · 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

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'),
        },
      ],
    }),
   ],
}