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

Webpack / UglifyJS bundling process issue #140

Closed
dptoot opened this issue Aug 8, 2017 · 5 comments
Closed

Webpack / UglifyJS bundling process issue #140

dptoot opened this issue Aug 8, 2017 · 5 comments

Comments

@dptoot
Copy link

dptoot commented Aug 8, 2017

Thanks for the utility, it is/was working great!

I am utilizing it in a custom addon for react-storybook. Until I upgraded react-storybook to their webpack 2 update it seemed to be working fine. But I am having an issue now with webpack/babel/uglify build of react-storybook processing this package. Digging into it this may not be an issue with react-element-to-jsx-string but really its stringify-object dependency.

sindresorhus/stringify-object#35

It seems that the compiled version was not intended for browser usages and it's compiled file is shipped containing arrow functions that will break within uglify since it won't process ES2015.

Is anyone else experiencing browser usage issues? I tried processing stringify-object with babel as part of the build but to no avail. Being that it is a dependency of a dependency I am not sure that the end user would be responsible or aware of how to use this properly...

Any ideas, suggestions, or solutions would be appreciated.

Thanks again!

@dptoot
Copy link
Author

dptoot commented Aug 8, 2017

Apparently this package's usage has already been called out within stringify-object's issues as well

sindresorhus/stringify-object#36

@bguggie
Copy link

bguggie commented Aug 8, 2017

have you tried uglify-es:
https://github.com/mishoo/UglifyJS2/tree/harmony
... supposed to handle uglifying es6+

@dptoot
Copy link
Author

dptoot commented Aug 8, 2017

I could perhaps use another minifier if I use the full control mode of storybook but at this time the minifier is baked in to their build target.

@armandabric
Copy link
Collaborator

armandabric commented Aug 10, 2017

Hi @dptoot,

For now we do not target browser usage for this project. As you're not the first to open an issue on this subject (#90) maybe we should consider it?

@vvo What did you think about this?

In the main time, the response given on the #90 issue could apply for you

@vvo
Copy link
Contributor

vvo commented Aug 28, 2017

have you tried uglify-es:
mishoo/UglifyJS2@harmony
... supposed to handle uglifying es6+

This is the right answer to this current issue, you could maybe contribute to storybook default minifier and use uglify-es as stated here: https://github.com/mishoo/UglifyJS2#note

Other relevant links:
sindresorhus/stringify-object#35
storybookjs/storybook#1570
storybookjs/storybook#1668

I am sorry this happens but stringify-object may have take this decision (of not building anymore for ES5) a bit too early. OR uglifyjs may have waited too long to implement changes to support ES6.

Either way, you have solution to fix this I believe in the post you saw.

Thanks a lot for contributing here!

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

5 participants