dropzone icon indicating copy to clipboard operation
dropzone copied to clipboard

"Cannot read property 'defaultOptions' of undefined" when update to 5.9.2

Open ipetrov87 opened this issue 4 years ago • 1 comments

Describe the bug I am not sure if this a bug, but here it is what is the issue that I have. I am trying to update from version "5.7.2" to the latest one "5.9.2" (at this moment). When I update the Dropzone version in package.json file and install it. Then I run npm run development (I am using Laravel Mix 6). I got this error in the console.

bootstrap.js:38 Uncaught TypeError: Cannot read property 'defaultOptions' of undefined

at this line

Dropzone.prototype.defaultOptions.resizeWidth = 1920

I use this to se a options that I want to be same for every Dropzone, without of need to repeat same code over and over. So I set options this way:

window.Dropzone = require('dropzone')
Dropzone.prototype.defaultOptions.resizeWidth = 1920
Dropzone.prototype.defaultOptions.resizeHeight = 1920
Dropzone.prototype.defaultOptions.resizeMethod = 'contain'
Dropzone.prototype.defaultOptions.resizeQuality = 0.85
Dropzone.prototype.defaultOptions.dictDefaultMessage = 'Some custom text'
Dropzone.autoDiscover = false
if (token) {
    window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content
    Dropzone.prototype.defaultOptions.headers = {
        'X-CSRF-TOKEN': token.content,
    }
}

Is it possible to done this in Dropzone "5.9.2". And if yes how i can do it?

Expected behavior To be able to set global default option value.

Browser / OS:

  • Windows 10 PC
  • Chrome
  • Version 90.0.4430.212 (Official Build) (64-bit)

ipetrov87 avatar Jun 03 '21 11:06 ipetrov87

+1. I accidentally updated to latest dropzonejs, and now nothing works. Going to go back to 5.7.2 until I have time to sort it all out.

DaleyKD avatar Jun 08 '21 19:06 DaleyKD