I am trying to test out your compressor plugin but getting an error when including it:
index.js:19 Uncaught TypeError: Illegal constructor
at _construct (index.js:19)
at UppyCompressor.Wrapper (index.js:15)
at new UppyCompressor (index.js:39)
at Uppy.use (index.js:1182)
at Object../app/javascript/packs/uppy.js (uppy.js:37)
at __webpack_require__ (bootstrap:19)
at bootstrap:83
at bootstrap:83
my code looks like this:
// Import the plugins
const Uppy = require('@uppy/core')
const XHRUpload = require('@uppy/xhr-upload')
const Dashboard = require('@uppy/dashboard')
const UppyCompressor = require('uppy-image-compressor')
// And their styles (for UI plugins)
require('@uppy/core/dist/style.css')
require('@uppy/dashboard/dist/style.css')
// const XHRUpload = Uppy.XHRUpload
const csrfToken = document.querySelector('meta[name="csrf-token"]').content
var uppy = Uppy()
.use(Dashboard, {
inline: true,
target: '#drag-drop-area',
showProgressDetails: true,
metaFields: [
{ id: 'caption', name: 'Caption', placeholder: 'describe what the image is about' }
],
})
.use(XHRUpload, {
endpoint: '/pages/photoconv',
headers: { "X-CSRF-Token": csrfToken }
})
.use(UppyCompressor, {
quality: 0.6
})
.on('complete', (result) => {
console.log('Upload complete! We’ve uploaded these files:', result.successful)
console.log('failed files:', result.failed)
})