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

Add closure compiler #358

Open
jaredpalmer opened this issue Dec 3, 2019 · 6 comments
Open

Add closure compiler #358

jaredpalmer opened this issue Dec 3, 2019 · 6 comments
Labels
good first issue Good for newcomers scope: internal Changes only affect the internal API

Comments

@jaredpalmer
Copy link
Owner

Steal it from here : https://github.com/ReactTraining/history/blob/dev/rollup.config.js

@swyxio swyxio added good first issue Good for newcomers scope: internal Changes only affect the internal API labels Dec 4, 2019
@ambroseus
Copy link
Contributor

ambroseus commented Dec 16, 2019

1st impression: it works :)
(test react app also works with compiled package)
just need to tune up configuration for typescript2 plugin:
https://github.com/ezolenko/rollup-plugin-typescript2#plugins-using-asyncawait
objectHashIgnoreUnknownHack: true
result:
Screenshot from 2019-12-16 22-37-28

@ambroseus
Copy link
Contributor

oh, I see difference in bundle size:
minified with terser: ~ 13900 b
with closure compiler: ~ 12700 b
(compilation_level: 'ADVANCED_OPTIMIZATIONS')

@swyxio
Copy link
Collaborator

swyxio commented Dec 17, 2019

good! what are the tradeoffs of simple vs advanced optimization?

we should try running against formik to get a good gauge on % savings

nice work so far!

@ambroseus
Copy link
Contributor

ambroseus commented Dec 17, 2019

good! what are the tradeoffs of simple vs advanced optimization?

SIMPLE_OPTIMIZATIONS do same things as Terser plugin (and in my case optimized bundle size was little bit larger than terser's one)
https://developers.google.com/closure/compiler/docs/api-tutorial3

BUT. there was a problem with 'ADVANCED_OPTIMIZATIONS' level in my lib with regeneratorRuntime polyfill

@ambroseus
Copy link
Contributor

can be implemented as tsdx plugin

@DrSensor
Copy link

Dynamic import doesn't work on the closure compiler 🤔
google/closure-compiler#2770

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers scope: internal Changes only affect the internal API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants