donatso / family-chart

family tree visualization built on top of d3
MIT License
204 stars 67 forks source link

Using family-chart with Laravel 10 Vite + React #28

Closed majster-pl closed 10 months ago

majster-pl commented 1 year ago

Hi, I'm working on family tree in my spare time and I come across your package which would work perfect for me but I having issue using it with above combination. I wonder if you'll be able to help me resolve the problem?

When importing f3 as in your React example import f3 from "family-chart"; // npm i family-chart I get error: [plugin:vite:import-analysis] Failed to resolve entry for package "family-chart". The package may have incorrect main/module/exports specified in its package.json.

I've asked for help laravel community but none of the suggestions worked so I thought I'll reach out to you. Here is a link to post in laracasts forum. https://laracasts.com/discuss/channels/vite/laravel-10-vite-react-problem-importing-npm-packages

Regards.

ed-fruty commented 1 year ago

Found this library and got the same error during the first try. So the fix is to change import path to the full one:

import f3 from "family-chart/dist/family-chart";