hMatoba / piexifjs

Read and modify exif in client-side or server-side JavaScript.
MIT License
571 stars 118 forks source link

Problem importing 2.0 beta #57

Open HarelM opened 5 years ago

HarelM commented 5 years ago

I've tried to use the latest version but I wan't able to use it like I did with 1.0.4: I'm using webpack. this doesn't work: import piexif from "piexifjs"; Also this didn't work: import * as piexif from "piexifjs"; I don't have other ideas I can try :-(

HarelM commented 5 years ago

Apparently, all methods have been moved to export so the usage is like so: import { load, dump, insert, TagValues, helper } from "piexifjs"; Probably a documentation update is needed...

hMatoba commented 5 years ago

Thank you for trying new version!

I want to reproduce error. Error is thrown by webpack? Could you tell me the error message?

HarelM commented 5 years ago

Thanks for the quick response! No error is thrown by webpack but the error is thrown on runtime - can't call laod of undefined. The only issue here is that I used this library wrong due to breaking changes in 2.0 version... :-( Nevertheless, I think the solution is to update the documentation and create typescript typing to allow users to have intellisense and auto complete when using typescript (which is what I use and anyone who writes angular code). See here how to add the typings to the project: https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html

hMatoba commented 5 years ago

I added TypeScript definition. But it's not enough. Welcome PullRequest.

HarelM commented 5 years ago

hmm, interesting, I wonder why I don't get proper intellisense then... Looking at the generated index.d.ts file I think the interfaces folder is missing in the released package: import * as interfaces from './interfaces';

image

image