-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[1.3.0 / 1.3.1] TypeScript Cropper.options dragMode breaks at runtime #308
Comments
Same problem here, it seems that the exports are missing in the actual js files, there only the |
I googled a bit the subject and I think the problem is somehow related to enum with typescript, webpack, loaders etc. For example I found such issues about this subject: typescript: microsoft/TypeScript#16671 don't know if that would then make sense to set back |
` ` |
@coloz maybe not the same I think this issue is related to a runtime problem |
I think it is not an issue of Cropper.js, but your TypeScript config... |
What's your config then if I could ask? |
Just for the record, even with the last commit of @fengyuanchen adding |
even workaround is not working. showing this error
[18:14:49] typescript: node_modules/cropperjs/types/index.d.ts, line: 4
[18:14:49] typescript: node_modules/cropperjs/types/index.d.ts, line: 5
[18:14:49] typescript: node_modules/cropperjs/types/index.d.ts, line: 16
[18:14:49] typescript: node_modules/cropperjs/types/index.d.ts, line: 17
[18:14:49] typescript: node_modules/cropperjs/types/index.d.ts, line: 18
|
@mathewk2017 Please try to the latest version (v1.4.0 currently). |
@fengyuanchen I am seeing this error at runtime. The Error:
The code: import Cropper from 'cropperjs';
const cropper = new Cropper(this.imageRef, {
dragMode: Cropper.DragMode.Move,
...otherOptions
}); Relevant webpack config: const config = {
module: {
rules: [
{
test: /\.jsx?$/,
use: [{loader: 'babel-loader', options: {...stuff}],
include: [
...otherIncludes,
/cropperjs\/src/
]
},
{
test: /\.tsx?$/,
use: [{loader: 'awesome-typescript-loader', options: {...stuff}],
include: [...otherIncludes, /cropperjs\/src/]
}
]
}
} |
The DragMode is not exported. |
I'm submitting a...
[X ] Bug report
Current behavior
With the introduction of typescript in 1.3.0, the Cropper.options
dragMode
is now defined as a type DragMode. Unfortunately, setting it to the constant value (see code below) will then fail at runtime with following error:Expected behavior
No error. A possible solution is maybe to set dragMode as
string
?Minimal reproduction of the problem with instructions
Environment
Cropper.js version: 1.3.1
Workaround
Right now, I have then declared dragMode like following to bypass the problem
The text was updated successfully, but these errors were encountered: