Skip to content

Can't use jspdf with a vite project. says Pre-transform error: failed to resolve import "jspdf" #3851

Open
@Nicolas-Mousten

Description

@Nicolas-Mousten

I have installed the latest version 3.0.1 with "npm i jspdf" and can se in my package json that i have version 3.0.1.
but when i try to import it to my component in react it throws this error:

[vite] Pre-transform error: Failed to resolve import "jspdf" from "node_modules/report-plugin/.medusa/server/src/admin/components/exportDashboard/exportService.js?v=20c6d6db". Does the file exist?

import { jsPDF } from "jspdf";

const constructPDFFormat = () => {
const doc = new jsPDF();
};

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