Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

to be lightweight templates for React, we shouldn't bundle lodash into the build #233

Open
rileylnapier opened this issue Nov 4, 2017 · 5 comments

Comments

@rileylnapier
Copy link

im a little bit upset about having 7kb bloating my build because of this library.

these seem to be what you need based on poking around the library: map, assign, defaults, keys, pick, identity, transform

i don't think it would be that difficult to move to native functions and/or writing some of the used lodash dependencies from scratch. im ok with using lodash to build the js file from the template, but im not happy with having to include lodash in my prod bundle.

im using babel-lodash plugin to minimize the lodash but 7kb that could be reduced does not equate "lightweight"

image

@rileylnapier
Copy link
Author

rileylnapier commented Nov 4, 2017

btw i do love the library and it helps us migrate a legacy angular 1.x templates to react. but i feel this lodash dependency is sticking out like sore thumb in our build process and eventually i will probably migrate to JSX to improve performance and optimize bundle size

@nippur72
Copy link
Contributor

nippur72 commented Nov 4, 2017

unfortunately, the PR that would help solve this is still pending for approval. My solution was to use external helper functions and do not rely explicitly on lodash (see also #184).

A possible workaround for this would be using the lodash-import-path flag to switch to your own implementation of lodash where you can have native functions with a minimal footprint. I have not tried it but it should work.

As for myself, I used a fork with my PR for a while, but since I needed more features I ended up writing a templating engine of my own.

In my opinion, html-templates are much more readable than JSX, but JSX carries several other advantages that it's difficult to make a choice. I currently use both.

@rileylnapier
Copy link
Author

why still pending? does wix not accept PR or are they busy?

@nippur72
Copy link
Contributor

nippur72 commented Nov 5, 2017

They do accept PRs but activity on this repo has dropped cosiderably in the past years. My guess is that they are no longer using it as a primary tool.

@rileylnapier
Copy link
Author

yeah. so probably should migrate away from it to plain jsx

@rileylnapier rileylnapier changed the title you say, Lightweight templates for React?? yeah maybe if it didn't bundle lodash into my build... to be lightweight templates for React, we shouldn't bundle lodash into the build Nov 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants