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

export error relativeTime #24

Closed Swepool closed 2 years ago

Swepool commented 2 years ago
The requested module '/node_modules/dayjs/plugin/relativeTime.js?v=14ef3dca' does not provide an export named 'default'
SyntaxError: The requested module '/node_modules/dayjs/plugin/relativeTime.js?v=14ef3dca' does not provide an export named 'default'
metonym commented 2 years ago

What set-up are you using? If you're using vite, you may need to optimize that file:

// vite.config.js
import { svelte } from "@sveltejs/vite-plugin-svelte";
import { defineConfig } from "vite";

export default defineConfig(() => {
  return {
    plugins: [svelte()],
    optimizeDeps: {
      include: ["dayjs/plugin/relativeTime.js"],
    },
  };
});
Swepool commented 2 years ago

That's correct, works flawlessly again! Thanks!