palantir / blueprint

A React-based UI toolkit for the web
https://blueprintjs.com/
Apache License 2.0
20.72k stars 2.18k forks source link

Standalone datetime package #245

Closed ggregoire closed 7 years ago

ggregoire commented 7 years ago

Hi!

I compared different calendar/datepicker libraries and I think yours in one of the best. Its API is simple and clean. Plus, it has a years selector (airbnb/react-dates doesn't).

Unfortunately, the core package is quite huge (> 1MB). It's the biggest package in my bundle.

Do you have any plans to make a standalone datetime package?

screen shot 2016-11-25 at 22 10 32

giladgray commented 7 years ago

Thanks @ggregoire! We worked hard on those datetime components, glad to hear you enjoy them as much as we do!

I can't say we have any plans to support standalone consumption. Blueprint is designed for an all-in approach where you need a lot of basic pieces to build a large application. Some judicious tree-shaking of unused code should get you pretty far in bundle size reduction, though I'm unfamiliar with how the tree is actually shaken.

adidahiya commented 7 years ago

For consumers to utilize tree shaking, we'll have to publish ES6 modules in addition to CommonJS modules (static analysis tools work much better with the former). Shouldn't be too hard; we can use tsconfig.json inheritance and create multiple folders in dist/, dist/es6/ and dist/cjs/

adidahiya commented 7 years ago

So, yeah the tree shaking thing ought to help somewhat. But Gilad is correct here, the UI kit works best when you use the core components, otherwise the app might feel pretty inconsistent. It's meant to replace packages like bootstrap, react-bootstrap, and react-overlays; after that, blueprint's bundle size feels like a bargain. Lastly, have you removed code comments in that bundle size analysis? I believe we ship dist/ with a lot of code comments (should fix that, as it's only important to have the comments in .d.ts files).

giladgray commented 7 years ago

I don't think this request is physically possible as datetime relies on a number of core components.

We've done some work to reduce bundle size (#112) and are tracking future improvements (#436). Feel free to file new issues with specific requests to reduce library size.