Browse Source

Merge pull request #698 from transloadit/fix/rollup

Fix `get-form-data` being undefined when built with Rollup
Artur Paikin 7 years ago
parent
commit
56f2d0319a
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/plugins/Form.js

+ 3 - 1
src/plugins/Form.js

@@ -1,6 +1,8 @@
 const Plugin = require('../core/Plugin')
 const { findDOMElement } = require('../core/Utils')
-const getFormData = require('get-form-data').default
+// Rollup uses get-form-data's ES modules build, and rollup-plugin-commonjs automatically resolves `.default`.
+// So, if we are being built using rollup, this require() won't have a `.default` property.
+const getFormData = require('get-form-data').default || require('get-form-data')
 
 /**
  * Form