Skip to content

Possible temp solution for dayjs import #61

Open
@Its-Just-Nans

Description

@Its-Just-Nans

Hello,
Here is a solution to using this library with vitejs as a bundler
working with "vite": "^3.0.7"

Step by step

install @rollup/plugin-replace

npm install @rollup/plugin-replace

change your vite.config.js

import { defineConfig } from "vite";
import relace from "@rollup/plugin-replace";
import { svelte } from "@sveltejs/vite-plugin-svelte";

export default defineConfig({
    plugins: [
        relace({
            preventAssignment: true,
            values: {
                "from 'dayjs": "from 'dayjs/esm",
            },
        }),
        svelte(),
    ],
});

Now you can use the DatePicker

<script>
import DatePicker from "@beyonk/svelte-datepicker/src/components/DatePicker.svelte";
</script>

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