question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Changes to the Croppie constructor using npm and Webpack

See original GitHub issue

Expected 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

  1. install the npm package
  2. 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:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

14reactions
mehmetgunacticommented, Feb 11, 2018

I have the same problem (2.6.1) :

When I use this.croppie = new Croppie.Croppie(this.croppieElement.nativeElement, { ... }); I get

core.js:1427 ERROR TypeError: Cannot read property ‘Croppie’ of undefined

and when I use this.croppie = new Croppie(this.croppieElement.nativeElement, { ... }); I get

ERROR TypeError: croppie_1.default is not a constructor

Second approach worked up until I updated to 2.6.1.

Edit: I solved it with changing : import Croppie from 'croppie'; to import { Croppie } from 'croppie/croppie';

2reactions
sarunintcommented, Apr 13, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found