Nickersoft / push-fcm-plugin

Official Firebase Cloud Messaging plugin for Push.js v1.0 :fire:
https://pushjs.org
42 stars 13 forks source link

import not working #5

Open sstubbs opened 7 years ago

sstubbs commented 7 years ago

First thank you for the brilliant push library. It works really well but I am having an issue with this plugin.

I have tried const Push = require('pushjs'); const PushFCM = require('pushjs-fcm');

as per the docs but it doesn't work.

I have changed the push import to const Push = require('push.js'); and this works fine but I can't get the plugin to work

For the plugin I have tried const PushFCM = require('pushjs-fcm'); which cannot find it const PushFCM = require('push-fcm-plugin'); which gives me e(...) is not a function error const PushFCM = require('push-fcm-plugin/bin/push.fcm'); factory(...) is not a function

I have installed both modules through npm.

Please let me know if this is a bug or if I am doing something wrong.

Thanks

Nickersoft commented 6 years ago

What environment are you loading it in? Node?

The following should be the correct import statement:

const PushFCM = require('push-fcm-plugin');
famence commented 6 years ago

I just changed factory(...)() to factory(...) and it resolves the "factory(...) is not a function" at push.fcm.js.