Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES6 module for PapaParse #813

Open
aishwaryasharma14 opened this issue Jun 30, 2020 · 7 comments
Open

ES6 module for PapaParse #813

aishwaryasharma14 opened this issue Jun 30, 2020 · 7 comments

Comments

@aishwaryasharma14
Copy link

aishwaryasharma14 commented Jun 30, 2020

While upgrading to Angular 10, using PapaParse gives following warning message - WARNING in C:\parser.component.ts depends on papaparse. CommonJS or AMD dependencies can cause optimization bailouts.

This seems to be because PapaParse is CommonJS module dependency.

I am importing papaparse as follows -
import * as csvParser from 'papaparse';

and using it as -
csvParser.parse(file, {});

Can you help me with an ES6 module that I could use instead?

@pokoli
Copy link
Collaborator

pokoli commented Jun 30, 2020

Currently the typescript defintions are managed here https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/papaparse So you should update them there.

See #545

@pokoli pokoli closed this as completed Jun 30, 2020
@PooSham
Copy link

PooSham commented Oct 7, 2020

@pokoli That doesn't seem very relevant at all. ES6 modules are part of modern javascript, they have nothing to do with typescript.

The import and export keywords are now native to javascript, and you can now isolate your files as modules without wrapping everything in a function that you call (like you do now). If you still want backward compatibility, you can use babel that will generate CommonJS and AMD modules for you. Your code gets cleaner and users of this library can get more aggressive optimization. win-win.

TLDR; Having typescript definitions is not enough. We want ES6 modules.

@pokoli
Copy link
Collaborator

pokoli commented Oct 7, 2020

@PooSham Thanks for the explanation. I will reopen the issue.

I think this should be part of a new major release to allow users continue using the current version.

I will be happy to review any PR implementing ES6 modules.

@pokoli pokoli reopened this Oct 7, 2020
@PooSham
Copy link

PooSham commented Oct 8, 2020

@pokoli Thank you for reopening it :)

Yes, making it a part of a major release seems reasonable.

I have quite a lot at work right now, but I might look at it in 2 weeks or so (can't promise though).

@zgosalvez
Copy link

Looking forward to this release. I fear my Angular app might break if we decide to continue upgrading to Angular 11.

@raysuelzer
Copy link

Looking forward to this release. I fear my Angular app might break if we decide to continue upgrading to Angular 11.

@zgosalvez Just upgraded to angular 11, no issues other than the library cannot be optimized for size.

Silic0nS0ldier added a commit to Silic0nS0ldier/PapaParse that referenced this issue Jun 9, 2021
- Use RollupJS and Terser for bundling
- Bumped up dev dependency versions
- Bumped up Travis NodeJS version matrix
- Refactored Papa worker identification
- Refactored worker logic to use `import.meta.url` or `document.currentScript.src`
mholt#748
mholt#813
@Silic0nS0ldier
Copy link

As a first step I've created a PR that introduces support in (hopefully) the least backwards incompatible way. The code I'm confident with, build system support less so. Anyone up for some integration testing? PR is #875

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants