Skip to content
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

_svgson.default.parse is not a function #12

Closed
SnooHD opened this issue Jan 6, 2019 · 2 comments
Closed

_svgson.default.parse is not a function #12

SnooHD opened this issue Jan 6, 2019 · 2 comments

Comments

@SnooHD
Copy link

SnooHD commented Jan 6, 2019

Hello,
I figured i should update to the newest svgson, but im not able to get it to work.
I simply used yarn add svgson.

Code:

let json;
try {
  json = await svgson.parse(optimized);
}catch (error) {
  console.log(error);
}

Error:

TypeError: _svgson.default.parse is not a function

My package.json shows "svgson": "^3.0.0"

Any ideas? :)

@elrumordelaluz
Copy link
Owner

Hi @SnooHD
It's more a documentation issue.

If you are using es or cjs, svgson is exported as default, for umd should work as in readme.

Recap, the following should work:

import svgson from `svgson`
json = await svgson(optimized)

// or
import { parse } from `svgson`
json = await parse(optimized)

Let me know in any case. And I have to fix docs asap.

@SnooHD
Copy link
Author

SnooHD commented Jan 7, 2019

Yes import {parse} from 'svgson'; works fine.
Thank you kindly!! <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants