Skip to content

Commit

Permalink
@uppy/image-editor: add workaround for when Cropper is loaded as ESM (
Browse files Browse the repository at this point in the history
#3218)

* @uppy/image-editor: add workaround for when `Cropper` is loaded as ESM

Fixes: #3199

* Update packages/@uppy/image-editor/src/Editor.js

Co-authored-by: Kevin van Zonneveld <kevin@vanzonneveld.net>

* Add backlog entry

Co-authored-by: Kevin van Zonneveld <kevin@vanzonneveld.net>
  • Loading branch information
aduh95 and kvz committed Sep 28, 2021
1 parent 7fd7b60 commit 46b0540
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions BACKLOG.md
Expand Up @@ -30,6 +30,7 @@ PRs are welcome! Please do open an issue to discuss first if it's a big feature,
## `3.0.0`

- [ ] Switch to ES Modules (ESM)
- [ ] @uppy/image-editor: Remove silly hack to work around non-ESM.

## `4.0.0`

Expand Down
6 changes: 5 additions & 1 deletion packages/@uppy/image-editor/src/Editor.js
@@ -1,6 +1,10 @@
const Cropper = require('cropperjs')
const CropperImport = require('cropperjs')
const { h, Component } = require('preact')

// @TODO A silly hack that we can get rid of when moving to ESM.
// eslint-disable-next-line no-underscore-dangle
const Cropper = CropperImport.__esModule ? CropperImport.default : CropperImport

module.exports = class Editor extends Component {
constructor (props) {
super(props)
Expand Down

0 comments on commit 46b0540

Please sign in to comment.