You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to import PapaParse from a Node.js ES module, the following error is shown:
import { parse } from "../../node_modules/papaparse/papaparse.js";
^^^^^
SyntaxError: Named export 'parse' not found. The requested module '../../node_modules/papaparse/papaparse.js' is a CommonJS module, which may not support all module.exports as named exports.
As a workaround, PapaParse can be imported using import papaparse from 'papaparse' and then accessing the function using papaparse.parse. As a workaround in code that is shared by the frontend and backend, PapaParse can be imported in the following way:
To fix the issue, PapaParse needs to publish a 3rd bundle in ESM format. The bundle needs to have the .mjs file extension and does not have to be minified or contain any shims or transpilations to support old browsers. Then the following export map needs to be added to package.json:
When attempting to import PapaParse from a Node.js ES module, the following error is shown:
As a workaround, PapaParse can be imported using
import papaparse from 'papaparse'
and then accessing the function usingpapaparse.parse
. As a workaround in code that is shared by the frontend and backend, PapaParse can be imported in the following way:To fix the issue, PapaParse needs to publish a 3rd bundle in ESM format. The bundle needs to have the
.mjs
file extension and does not have to be minified or contain any shims or transpilations to support old browsers. Then the following export map needs to be added topackage.json
:The wildcard export at the end is to provide backwards compatibility with existing projects that are importing PapaParse in unusual ways.
The text was updated successfully, but these errors were encountered: