metonym / svelte-time

Svelte component and action to format a timestamp using day.js
https://metonym.github.io/svelte-time
MIT License
137 stars 8 forks source link

fix(dayjs): use CJS instead of ESM #22

Closed metonym closed 2 years ago

metonym commented 2 years ago

This is actually a second attempt at https://github.com/metonym/svelte-time/pull/13.

It uses the CJS build for dayjs, so vite/SvelteKit can optimize the dependency. The reason #13 was reverted because it stopped working with Snowpack.

I'll publish this under a next tag and play around with it. Even if it does break Snowpack, I think it's more important to unblock vite/SvelteKit usage.

metonym commented 2 years ago

Tested this with rollup/webpack/vite/SvelteKit/sapper and they all work.

Snowpack dev works but fails at build:

Duplicate export 'default' in dayjs.min.js

I'm going to release this (removing the next tag) since it's more important to unblock SvelteKit usage.