zengm-games / facesjs

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

React is needed to be able to generate faces #51

Closed Yasso9 closed 1 month ago

Yasso9 commented 1 month 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 1 month 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 1 month ago

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

Yasso9 commented 1 month ago

Thanks a lot for your quick answer and the workaround !

dumbmatter commented 1 month ago

Fixed in version 4.2.2