zengm-games / facesjs

A JavaScript library for generating vector-based cartoon faces
https://zengm.com/facesjs/
Apache License 2.0
1.29k stars 99 forks source link

React is needed to be able to generate faces #51

Closed Yasso9 closed 3 months ago

Yasso9 commented 3 months ago

I have a vue.js project and to be able to use this library I need to have React installed.

Here is the code that I use in my project :

import { generate } from "facesjs";
const face = generate()

If React is not installed, I have the following error, even if I did not import explicitly face:

[1]  ERROR  [worker reload] [worker init] error: Cannot find package "react" from "node_modules/facesjs/build/esmodules/Face.js"
dumbmatter commented 3 months ago

My bad, I guess I was thinking that tree shaking would get rid of the react component if it wasn't being used, but that is definitely not always true. Will try to fix this later today.

dumbmatter commented 3 months ago

Also in the mean time if you downgrade to version 4.1.1 it should work.

Yasso9 commented 3 months ago

Thanks a lot for your quick answer and the workaround !

dumbmatter commented 3 months ago

Fixed in version 4.2.2