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 encounters SyntaxError #160

Closed
brumm opened this issue Aug 22, 2016 · 5 comments
Closed

UglifyJs encounters SyntaxError #160

brumm opened this issue Aug 22, 2016 · 5 comments

Comments

@brumm
Copy link

brumm commented Aug 22, 2016

Hey @insin,

I'm running into an error when trying to build an app which imports https://github.com/Cu3PO42/electron-ipc-tunnel:

SyntaxError: Unexpected token: name (IpcClient) [./~/electron-ipc-tunnel/client.js:11,0]
electron/ doesn't exist

nwb serve is working without problems, only nwb build fails :(

test repo with minimal nwb react-app which reproduces the issue is here: https://github.com/brumm/test

Env:

Darwin 15.6.0
node v5.3.0
npm  v3.3.12
@insin
Copy link
Owner

insin commented Aug 22, 2016

It looks like this module has published untranspiled ES6 to npm, which as far as I'm aware isn't supported by UglifyJS yet.

Not that it seems to make a difference in this case, but is the extra target config value valid?

@brumm
Copy link
Author

brumm commented Aug 22, 2016

Dang, I should probably have spotted this myself. Thanks for pointing me in the right direction!

Not that it seems to make a difference in this case, but is the extra target config value valid?

Yeah, it's just not documented (yet?)
https://github.com/webpack/webpack/blob/314c897682b556845fea36d329de8016d1740900/lib/WebpackOptionsApply.js#L154

@brumm brumm closed this as completed Aug 22, 2016
@insin
Copy link
Owner

insin commented Aug 23, 2016

Do people generally compress code for Electon apps? It should be possible to disable use of uglify if Node >= v4 is the target anyway.

insin added a commit that referenced this issue Aug 23, 2016
Document configuration for stripping dev-only code without compressing/mangling

Disabling might be needed for cases like #160, where a dependency has shipped untranspiled ES6 (which UglifyJS can't currently handle)
@brumm
Copy link
Author

brumm commented Aug 23, 2016

Awesome! I tried to do this via the individual options mangle: false and compress: false but that didn't work.

insin added a commit that referenced this issue Sep 29, 2016
Document configuration for stripping dev-only code without compressing/mangling

Disabling might be needed for cases like #160, where a dependency has shipped untranspiled ES6 (which UglifyJS can't currently handle)
insin added a commit that referenced this issue Dec 9, 2016
Document configuration for stripping dev-only code without compressing/mangling

Disabling might be needed for cases like #160, where a dependency has shipped untranspiled ES6 (which UglifyJS can't currently handle)
@cedricdelpoux
Copy link

I have also a problem with this UglifyJS version with the react-element-to-jsx-string lib. See here

@insin There is an es6 version of UglifyJS2 on the harmony branch.

Could you consider use it?

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

3 participants