You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is better than shipping all the locales, but it doesn't completely solve the problem because we're still shipping locales that the user doesn't need. This is okay if you're only supporting a small amount of locales, but this means that your bundle size will grow the more locale you support.
I feel like there should be a way to ship only the locale that the user needs. Especially in server-rendered frameworks like Next.js. I tried to use dynamic imports, but unfortunately this will ship all the locale files because date-fns/locale requires tree-shaking at bundle-time. If you can import individual locale files, this might work though.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
The docs currently recommends doing something like this:
This is better than shipping all the locales, but it doesn't completely solve the problem because we're still shipping locales that the user doesn't need. This is okay if you're only supporting a small amount of locales, but this means that your bundle size will grow the more locale you support.
I feel like there should be a way to ship only the locale that the user needs. Especially in server-rendered frameworks like Next.js. I tried to use dynamic imports, but unfortunately this will ship all the locale files because
date-fns/locale
requires tree-shaking at bundle-time. If you can import individual locale files, this might work though.Does anyone have any ideas?
Beta Was this translation helpful? Give feedback.
All reactions