-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Replace UglifyJS with babel-minify #1733
Replace UglifyJS with babel-minify #1733
Conversation
UglifyJS does not support any ES6 whatsoever. We want to allow users to set their own target env.
Codecov Report
@@ Coverage Diff @@
## release/3.3 #1733 +/- ##
===============================================
- Coverage 22.77% 22.77% -0.01%
===============================================
Files 326 326
Lines 6753 6754 +1
Branches 829 841 +12
===============================================
Hits 1538 1538
+ Misses 4621 4607 -14
- Partials 594 609 +15
Continue to review full report at Codecov.
|
I tried to test it locally with my branch and it takes about 8 min to finish building (I will try to clean everything and run it again tomorrow) |
Wow, that's a long time.. For me it was about 80 seconds |
got 87 sec today! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd love to have it merged
I want someone to verify react-native other then me |
I tried it with RN-vanilla (just ran the storybook as usual), and it worked fine. How do I run a build with RN? |
I'm not sure that build is implemented yet for RN (https://github.com/storybooks/storybook/tree/master/app/react-native/src/bin), so I wonder if the prod babel config for RN serves any purpose? |
@tmeasday I've looked into this, and it would appear there is no production build possible for RN. I'm hoping @mnmtanish can verify? |
So do those errors happen foryou in IE11 only, or in other browsers as well? |
In Chrome and FF |
I can confirm this in Chrome on mac as well (when running |
The problem was the name mangling, plus the fact that we have to use |
Nice! But what is the bundle size now ? |
For |
This feels like something that's valuable for us to get merged. |
|
…inify # Conflicts: # yarn.lock
Latest stats: before 'mangle'manager = 1.915.735 bytes (1,9 MB on disk) after 'mangle'manager = 1.332.127 bytes (1,3 MB on disk) |
@ndelangen you mean mangle right? I still don't think we should be using |
I'd prefer to keep avoiding mangling. Even in the case of static build, storybook is still a developer tool, and debugging experience should be among top priorities. And I believe we actually display some original variable and function names in addons like info and actions. |
@shilman is there anything else that should be done here in your opinion? |
@ndelangen we need to apply the same changes to angular app |
Putting this back into the freezer, gonna have a look at the uglify-webpack-plugin that was mentioned: #1733 (comment) |
@ndelangen Thank you for looking into this issue! Since i am also interested in this fix and i had some free time, i tried to use Please, check it when you have time |
Thank you @ggarek, I will close this PR in favour of yours! |
This came up in: #1501
A node_module we want to use has not been transpiled to es5 before publishing.
We could add the module to be run through babel, or we could do this:
Switch over to an alternative minifier. This PR swaps UglifyJS for Babel-Minify.
Why? Well the browsers we target actually support 90%+ of ES6+. Transpiling down
Related issue: #1005
This only affects static builds!
How to test
Run
yarn build-storybook
on cra-kitchen-sinkServe the static site
What about bundle size?
1.396.924 bytes (1,4 MB on disk)
That's down considerably from before:
2.032.284 bytes (2 MB on disk)