We've moved discussions to Discord

Setting Webpacker Javascript Options

Dan Tappin
I am a bit over my head - I have installed a few Webpacker modules for example Dropzone:

require('dropzone')
 
I and it works - I have it on a page which I would like to specify the options:

https://www.dropzonejs.com/#configuration-options

like this for example:

Dropzone.options.newUpload = {
  paramName: 'upload[file]',
  maxFilesize: 100
}

I have tried adding this in several places including directly before the dropzone form in the view in a <script> tag.  No matter what the console throws errors (mostly 'Dropzone undefined' type errors).

I am guessing I am just not setting this correctly.  Any tips / suggestions?

Thanks,

Dan
Chris Oliver
How are you creating your Dropzone instance? The configuration options there are if you've assigned it to "Dropzone" which isn't something that a require() in Javascript does by default.
Dan Tappin
Stackexchange to the rescue:

https://stackoverflow.com/a/58080171/1135515

import Dropzone from 'dropzone'
Notifications
You’re not receiving notifications from this thread.