Comments (11)
An option to exclude the Array.from()
polyfill (polyfills/array.from.js
) could reduce the size a bit too, for users who are already loading a polyfill for this feature, or for users who only support browsers with native support for Array.from()
I think I've seen other libraries do this by providing a library.min.js
file without the extras, and a library.all.min.js
with the extras bundled in.
from goodshare.js.
@tracker1 @philwolstenholme fix 6.0.0
, thanks for support!
from goodshare.js.
@koddr would still add closure[1], to see how small you can get it, 38kb is still very large for what this library does. Another possibility would be conditional builds, so only the social networks desired are actually built. Like one with top (facebook, twitter, instagram, pinterest), and another with all.
Alternatively a plugin structure, so that each social network is a separate add-in that can be joined into a single script after the fact, or loaded adjacently.
[1] https://github.com/ampproject/rollup-plugin-closure-compiler
from goodshare.js.
@tracker1 hm.. rollup-plugin-closure-compiler
does similar 38kb.. what's principle different between him and rollup-plugin-uglify
(what I use in 6.0.0)?
from goodshare.js.
If you can use the ADVANCED option for closure, it should gain you some size...
from goodshare.js.
And one more.. how do you want to cut Babel
from build? I use class
and other ES6+ code, I have no idea how I may cut this JS compiler. Can you help me?
from goodshare.js.
If you can use the ADVANCED option for closure, it should gain you some size...
So, I use it:
...
compiler({
compilation_level: "ADVANCED"
})
...
Output size is 34 857 bytes
(~35 kb). Profit is ~3 kb. Okay.
from goodshare.js.
class syntax would be hard without babel... you'd have to convert everything to prototype based inheritance modelling, which may not be worth it... though you may gain more by setting the minimum browser for your @babel/preset-env to IE9 or IE11 (depending on where you want to cut) as it is, it's generating transforms and using fills you don't actually need.
from goodshare.js.
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"ie": 9,
"esmodules": true
},
"useBuiltIns": "usage",
"loose": true
}
]
]
}
from goodshare.js.
You shouldn't need the separate Array.from
polyfill, the above should give it to you as-needed.
from goodshare.js.
@tracker1 I switched back compilation_level
to "SIMPLE" and delete "loose": true
, because it's totally broke my bundle. You may see errors at 6.0.3 version.
Now, goodshare.js
is back to 38 Kb and... it's better, than not working bundle!
from goodshare.js.
Related Issues (20)
- Counters don't work HOT 3
- Callback for success share HOT 2
- Don`t wokr data parametrs HOT 2
- Смена ссылки Telegram HOT 6
- We are missing Vimeo, Snapchat, Slideshare sharing option HOT 1
- Facebook sharing doesn't seem to work HOT 7
- Add chinese social media HOT 3
- Facebook, Googleplus and Stumbleupon Cannot Share The Correct Data HOT 3
- Does not work sharing in Odnoklassniki HOT 2
- whatsapp should be included
- Popup centering logic doesn't work correctly on multiple monitors HOT 2
- Поддержка IE11 HOT 3
- Facebook messenger support, in your roadmap ? HOT 3
- Having error with whatsapp HOT 10
- Задание data-url на лету HOT 3
- please add flickr & snapchat HOT 9
- Snapchat: The Snapchat is not working through the social share HOT 2
- Copy link to clipboard HOT 3
- Add Typescript HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from goodshare.js.