Enable tree shaking for date-fns
See original GitHub issue- Introduce modules index file and add it to
package.json
asmain
- Add docs
Issue Analytics
- State:
- Created 8 years ago
- Reactions:7
- Comments:5 (3 by maintainers)
Top Results From Across the Web
date-fns 2 - can't get tree-shaking to work - Stack Overflow
To make tree-shaking work you have to configure TypeScript to compile to ES Modules instead of CommonJS and also enable production mode in ......
Read more >Tree shaking issue in 2.17 · Issue #2207 · date-fns ... - GitHub
I'm using date-fns in two projects (without additional locales) and when I upgraded to 2.17 the bundle size went to ~200Kb.
Read more >Treeshaking Date-Fns with Webpack 4 - The Aurelia Discourse
Tree -shaking creates problems that should not exist in first place. You can turn it off in webpack config. At least Aurelia v1...
Read more >You can also look to date-fns. It has good tree shaking support.
If I am looking for python-dateutil.parser.parse in JavaScript of DateTime string of unknown format; what is the best library, for both Node.js environment ......
Read more >ECMAScript Modules in date-fns v2
In this post, I tell about ECMAScript Modules support in date-fns v2 that among other goodies enables tree-shaking out of the box.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Somewhat relevant… but I created a babel plugin that saves some keystrokes. It translates:
to
https://github.com/existentialism/babel-plugin-date-fns
Usual caveat of it working fine for our internal projects, but it could definitely use more feedback/usage.
(Also happy to transfer over to the date-fns org if interested!)
@kossnocorp 👍 it would be great to use like
import {parse, format, max, min} from 'date-fns'
in future without worrying about bundle size