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

UglifyJs error #47

Closed
xorbis opened this issue Mar 19, 2018 · 8 comments
Closed

UglifyJs error #47

xorbis opened this issue Mar 19, 2018 · 8 comments
Assignees

Comments

@xorbis
Copy link

xorbis commented Mar 19, 2018

I get this using webpack 3.11

ERROR in static/js/vendor.dcc406ea8a86a42719e0.js from UglifyJs
Unexpected token: name (endOfLine) [./node_modules/jsonexport/lib/core/escape-delimiters.js:13,0][static/js/vendor.dcc406ea8a86a42719e0.js:641,6]
@AckerApple
Copy link
Collaborator

AckerApple commented Mar 19, 2018

My best guess is webpack is having a tough time with this code: https://github.com/kauegimenes/jsonexport/blob/master/lib/core/escape-delimiters.js#L26

I think webpack is having an issue with a multlined ternary statement

I will not be performing additional testing or research on this issue. That is my guess. Try editing that file in your local copy and turn the ? statement into an IF ELSE, if it works then we can talk more.

@xorbis
Copy link
Author

xorbis commented Mar 19, 2018

The error was on line 13
https://github.com/kauegimenes/jsonexport/blob/master/lib/core/escape-delimiters.js#L13
A let statement...

Changing it to var works but fails on the next let statement.
I am hoping top use jsonexport in the browser for a VueJS streamed client request to convert JSON to CSV. Works fine in non-uglified mode.

This leave me wondering if babel parses the module to convert it to ES5 since UglifyJs only supports ES5.
Anyhow it's probably not a jsonexport issue but all other modules import and uglify fine.

@AckerApple
Copy link
Collaborator

Ohhhh shit, you are trying to webpack..... duh... one second

@AckerApple
Copy link
Collaborator

AckerApple commented Mar 19, 2018

Please read the documentation on using jsonexport in the browser and you'll be fine:

https://www.npmjs.com/package/jsonexport#browser

@AckerApple
Copy link
Collaborator

Please close issue when satisified

@xorbis
Copy link
Author

xorbis commented Mar 19, 2018

import jsonexport from "jsonexport/dist";
Thank you sooo much!
Cheers from Quebec/Canada!

@xorbis xorbis closed this as completed Mar 19, 2018
@AckerApple
Copy link
Collaborator

Hey Quebec/Canada, you're using TypeScript? Hell yeah, Angular5? I swear I've seen your face on other issue reports.

Besides the point, an Angular5 project needed in-browser exporting which brought me to jsonexport last year which was NOT webpack compatible until I added it and became a contributor of this package.

I do love this package a lot. It has made my exporting life, in browser especially, a world of easier than in the past.

Farewell good fella

@xorbis
Copy link
Author

xorbis commented Mar 20, 2018

Our stack is... https://stackshare.io/leadfox/leadfox
I fell in love with VueJs's simple setup and lightness.

We use jsonexport to Promise.each() multiple Rest API requests over millions of contacts for CSV exports.
With jsonexport we can let the web client work instead of preparing the CSV server-side.

Thanks again.

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

No branches or pull requests

2 participants