Skip to content

Locales bloating bundle size to 896kb #3040

Answered by fturmel
devuxer asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @devuxer,

Can't reproduce the problem over here with CRA 5.0.1, date-fns 2.28, source-map-explorer 2.5.2 and this small demo app:

// src/App.js

import { format, parseISO } from 'date-fns';

function App() {
    return (
        <>
            <div>Current date: {format(new Date(), 'yyyy-MM-dd')}</div>
            <div>Parse: {parseISO('2022-05-14').toLocaleString()}</div>
        </>
    );
}

export default App;

I'm not importing anything from "date-fns/locale"

Something in your app must be importing locales, because the library itself only references en-US and only does so for functions with a locale option.

What could I be doing wrong?

Some ideas to investigate:

  • Are you using…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@devuxer
Comment options

Answer selected by devuxer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants