-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dropzone is not a constructor #1903
Comments
What package manager? |
It's an Aurelia TS App build with NPM\Node\Gulp served by IIS running in the Browser\Chrome Just upgrading (ie npm update) breaks the project HTH, Thanks |
Are you sure you tested the latest release as well? |
I'll try to find some time to investigate this tomorrow. The file should be a UMD. If you're not doing anything wrong (which I'm assuming is the case, since what you're describing seems rather straight forward and it has worked before) I'll make sure it's solved quickly. |
Also in my config.js paths: { Thanks, |
I don't think it will make a difference, but could you try to change the path to point to |
yea... tried that - didnt see, to matter, it found it but was still a "Module" and not the Function like prior. |
I can confirm the problem of @mPisano. |
The following import works for me.
|
What about They should be identical. |
yes, either dropzone or dropzone-amd-module works as long as you "import Dropzone from x" also if I use the original "import * from dropzone" and I intentionally call the default constructor, it also works this.zone = new (Dropzone.default)(this.targetElement, {url: this.url || 'unspecified-url', acceptedFiles: 'application/pdf' }); this.zone = new (Dropzone)(this.targetElement, {url: this.url || 'unspecified-url', acceptedFiles: 'application/pdf' }); So the underlying issue seems to be this new build can't find the default constructor although you can see from the picture above that it's in the module? I think it's related to the following: see: HTH |
Thank you so much @mPisano ! That saved me a ton of researching. I'll release it tomorrow. In the future I'll pack an es module file separately to this, unrelated to modules so it can be imported without the AMD stuff. |
Could you please share more of your build process, I'm not able to reproduce it. I've created a sample project with this dependency: "dependencies": {
"dropzone": "5.7.6"
} I then used a simple webpack config: // webpack.config.js
const path = require("path");
module.exports = {
mode: "development",
entry: "./src/index.js",
output: {
filename: "main.js",
path: path.resolve(__dirname, "dist"),
},
}; And inside my import Dropzone from "dropzone";
// Works as well:
// import { Dropzone } from "dropzone";
console.log(new Dropzone("#foo")); This works as expected |
It is a SPA using AureliaJS |
Can you provide a bare minimum project that I can use (or link me to one) so I can test it out? |
@enyo
While inside the Maybe this helps. |
Check the issue here for more info dropzone/dropzone#1903
For @leonp5 and others (actual for latest version of plugin):
|
@7iomka thanks for your hint.
that comes because of this workaround to make post without file possible:
Got it from this Stackoverflow post, second answer. Do you have a hint for this scenario? Or somebody else? |
Version 5.9.3 gives me
|
@xhafan It's very likely because your import is incorrect. Make sure you use:
or simply: |
Dropzone v6.0.0-beta.1 has just been pushed and it has a predictable behaviour in regards to this: ECMAScript / JavaScript module: or you use the |
Error getting in console: --- Added in .ts file in angular project: Angular version: "@angular/core": "^5.2.4", Can you give any idea how to fix this issue. |
import * as Dropzone from 'dropzone';
this.zone = new (Dropzone)(this.targetElement, {url: this.url || 'unspecified-url', acceptedFiles: 'application/pdf' });
Unhandled rejection TypeError: Dropzone is not a constructor
What did you do???? These changes should not be n a .1 release
i've gone back to:
npm i dropzone@5.7.2
and all is working now
The text was updated successfully, but these errors were encountered: