jsnanigans / blac

BLoC pattern for react.
https://blac-docs.vercel.app
MIT License
36 stars 2 forks source link

Webpack failing to compile the library (Gatsby - React project) #2

Closed chmiguel closed 2 years ago

chmiguel commented 2 years ago

Hi, first of all, I want to thank you for this great work. 🍺 🍺

I was able to try the library out on a create react app and It worked really well. I also tried to test it on a gatsby-react project, and webpack failed to compile it.

I had to do this to get the library working (Import directly from the source and not from the built files):

import { BlocReact } from "bloc-react/src/lib";

I also was thinking that you could split this library into two different libraries, one for the core bloc clases (Bloc&Cubit), and one for the React utilities to use the core ones. Since the business logic should have nothing to do with the framework we use, we could use your core bloc classes in a Vue project, or imagine that we created an app with the bloc pattern in React, but for any reason we had to change to Vue, the impact would be much less if all the business logic has nothing to do with the framework we used for the UI. There are plenty of examples of MVP architecture that has the same business logic for 2 different implementations. Let me know what you think, and again thanks for all your work.

jsnanigans commented 2 years ago

@chmiguel Thanks for the great suggestions, I will definitely consider splitting this into two libraries!

I probably need to fix something in the rollup configuration to make it work with gatsby, should be easy to fix!

jsnanigans commented 2 years ago

@chmiguel fixed in https://github.com/jsnanigans/bloc-react/releases/tag/v0.1.29, it works now with gatsby and other webpack/es5 based projects 🎉