Skip to content

Problem with dayjs in Svelte 3 #59

Open
@risalfajar

Description

@risalfajar

Hello, I'm using this DatePicker for Svelte (not Svelte-kit) project with Vite. However the browser's console print this error:

Uncaught (in promise) SyntaxError: The requested module '/node_modules/dayjs/plugin/isSameOrAfter.js?v=493692cb' does not provide an export named 'default'

My vite.config.js:

import {svelte} from '@sveltejs/vite-plugin-svelte'
import {defineConfig} from 'vite'
import {minify} from 'html-minifier'

const minifyHtml = () => {
    return {
        name: 'html-transform',
        transformIndexHtml(html) {
            return minify(html, {
                collapseWhitespace: true,
            })
        },
    }
}

module.exports = defineConfig(({mode}) => {
    const isProduction = mode === 'production'

    return {
        optimizeDeps: {
            exclude: ['@roxi/routify'],
        },
        plugins: [svelte(), isProduction && minifyHtml()],
        build: {
            minify: isProduction,
        },
    }
})

Is there any solution for this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions