Facebook plugin import error

Hey, I’m trying to use facebook plugin but I get the error: “Uncaught TypeError: Expected a plugin class, but got undefined. Please verify that the plugin was imported and spelled correctly.”

the steps I did were:
changed scripts to :
https://transloadit.edgly.net/releases/uppy/v1.6.0/uppy.min.css and
https://transloadit.edgly.net/releases/uppy/v1.6.0/uppy.min.js

npm install @uppy/facebook

const uppy = Uppy.Core({…}).use(Uppy.Facebook, { target: Uppy.Dashboard, companionUrl: …})…

I will appreciate any help!

I know this is a late reply, but if you still have this issue, then I can probably help. If you only installed the @uppy/facebook package, that is your first issue. You’d also need @uppy/core. The docs explain this well.

Also if you are using @uppy/facebook, you should be referring to the plugin by the name you imported as

Example:

const Uppy = require('@uppy/core')
const Facebook = require('@uppy/facebook')

const uppy = Uppy()
uppy.use(Facebook, {
  // Options
})

You could also install uppy and use tree-shaking and ES modules. Although if you aren’t using something like Babel, ES modules won’t work

import Uppy, { Facebook } from 'uppy';

const uppy = Uppy();
uppy.use(Facebook, {
  // Options
})

Note: The docs warn of using the uppy package without tree-shaking configured

You can also use the combined uppy package, which includes all plugins that are maintained by the Uppy team. Only use it if you have tree-shaking set up in your module bundler, otherwise you may end up sending a lot of unused code to your users.

Based of the fact that you are coming from using the CDN, I’m assuming that you aren’t using a module bundler. Therefor, the first approach is probably the best option for you

I hope this helped. Let me know if you have any further issues or questions

- Andrew