Changes to the Croppie constructor using npm and Webpack
See original GitHub issueExpected Behavior
In previous versions it was possible to create a new Croppie instance using:
import Croppie from 'croppie';
var croppie = new Croppie(ref, opts);
Actual Behavior
Following the latest update this is no longer possible, you need to use the following syntax for it to work:
import Croppie from 'croppie';
var croppie = new Croppie.Croppie(ref, opts);
Is this an intended change in how the library is supposed to be used with npm, or is there something wrong?
Steps to Reproduce the Problem
- install the npm package
- import Croppie and try to create a new instance
Specifications
- Browser: The problem is not browser specific
- Version: Croppie 2.6.1
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
A brand new website interface for an even better experience!
Changes to the Croppie constructor using npm and Webpack.
Read more >webpack imported module is not a constructor - Stack Overflow
After encountering the "is not a constructor" issue, it took me hours of searching to find the default solution.
Read more >class extends value undefined is not a constructor or nul
I reinstalled nodejs and adonisjs but still getting same error. BONUS (a sample repo to reproduce the issue). NONE. Open side panel.
Read more >Webpack 5 release (2020-10-10)
Webpack 5 generates typescript typings from source code and exposes them via the npm package. MIGRATION: Remove @types/webpack . Update ...
Read more >Untitled
While trying to debug this I changed the js After changing the production ... Collection is not a function. crop and upload photo...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have the same problem (2.6.1) :
When I use
this.croppie = new Croppie.Croppie(this.croppieElement.nativeElement, { ... });
I getand when I use
this.croppie = new Croppie(this.croppieElement.nativeElement, { ... });
I getSecond approach worked up until I updated to 2.6.1.
Edit: I solved it with changing :
import Croppie from 'croppie';
toimport { Croppie } from 'croppie/croppie';
Update:
I’ve been spending today trying to convert Croppie to more modern Javascript. (I mean ES2015.)
I’m expecting it to be done next week.