mholt / PapaParse

Fast and powerful CSV (delimited text) parser that gracefully handles large files and malformed input
http://PapaParse.com
MIT License
12.44k stars 1.14k forks source link

ESM support #977

Open btakita opened 1 year ago

btakita commented 1 year ago

In a node.js environment, Papa parse only supports commonjs. I will create a PR to add ESM support.

dandv commented 1 year ago

Would be great to add at least one example of using import/require. Currently there's no such example anywhere.

troptropcontent commented 1 year ago

Hello,

I am pretty new with javascript

I am working with a rails 7 app, and trying to make this work,

In my script i have :

import Papa from "https://unpkg.com/papaparse@latest/papaparse.min.js";

But in my browser console i have the following error :

SyntaxError: The requested module 'papaparse' does not provide an export named 'default'

Is this the same issue ? 🤔

Any idea of how to make this work ? 🤔

crfrolik commented 6 months ago

Is there an update on the progress of this? Using papaparse in a project with "type":"module" (via tsx) gives me this error:

import { parse, ParseResult } from 'papaparse';
         ^

SyntaxError: The requested module 'papaparse' does not provide an export named 'parse'

Oddly enough, this works:

import papaparse from 'papaparse';

const { parse } = papaparse;