landau / predicate

Adding clarity and conciseness to your JS through predicates

Home Page:http://landau.github.io/predicate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Predicate breaks create-react-app build process

czycha opened this issue · comments

Predicate is a deep dependency of a React component that I'm using for a web app that I'm building off of create-react-app.

Running the app, everything works great. However, when trying to build the app for deployment, it isn't able to do so since Predicate uses ES6 features and cannot be minified.

This is mainly because the entry point of this module is index.js, which is ES6, instead of the precompiled version in the dist folder. As this is a deep dependency, I cannot just simply import "predicate/dist/predicate" instead of "predicate"—this change needs to happen in the module which depends on Predicate.

Should Predicate have its entry-point be changed to the non-ES6 compiled version in the dist folder, or should I ask the maintainer of the module which depends on Predicate to change their imports to the dist folder?

commented

I am extremely hesitant to change predicate back to ES5. This module intends to follow Node LTS.

It seems more appropriate to me that the maintainer of the module you're using publish their module as ES5 since react is mostly a FE concern. Though, this is actually stems from create-react-app's inability to handle 3rd party modules appropriately.

You may want to consider switching to webpack or browserify as you may run into this issue again with another module. Thanks for reaching out.

Yeah I agree. create-react-app should have a different process for dealing with modules since each module is different. Unfortunately, webpack and browserify aren't options since create-react-app abstracts the build process from the developer. I'll contact the module maintainer. Thanks for your timely reply.

commented

Sure thing. :)

What I meant by switching to webpack was to abandon create-react-app as your application builder. I believe webpack works well with babel, which works well with react applications.

Ahhh I understand. Yeah that could be an option.

commented

Good luck.