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

Vue CLI Web Component export contains all the Font Awesome icons #172

Open
Bounty31 opened this issue Mar 27, 2019 · 4 comments
Open

Vue CLI Web Component export contains all the Font Awesome icons #172

Bounty31 opened this issue Mar 27, 2019 · 4 comments

Comments

@Bounty31
Copy link

I am trying to export a component as a Web Component using the latest Vue CLI, the component uses the FontAwesomeIcon component.

I followed the example in the README (https://github.com/FortAwesome/vue-fontawesome#web-components-with-vue-web-component-wrapper) and it works correctly but I noticed that the exported Web Component is including not only the icons it should but all of the Font Awesome icons.

This is the output size of the normal build (which includes only the used icons) Vue Cli normal build size

This is the output size of the Web Component build
Vue Cli export as web component size

It includes all the Font Awesome icons, looks like the Tree Shaking is not happening for some reason..
hello-world-web-component exported code

Here is a test repository
https://github.com/Bounty31/vue-cli-font-awesome-web-component

@raymondtri
Copy link

I have noticed this too, it's really disappointing.

@raymondtri
Copy link

Digging even deeper into this, tree shaking is not working properly on vue from @fortawesome/fontawesome-svg-core.

This is adding a tremendous amount of weight to the package as well.

Here is the production size of my app.js without loading anything fontawesome:
image

Here is the production size of my app.js with just the following lines (vue-fontawesome):

import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
Vue.component('font-awesome-icon', FontAwesomeIcon);

image

Here is the production size of my app.js with just the following lines (fontawesome-svg-core, note I am not even importing any icons):

import { library } from "@fortawesome/fontawesome-svg-core";

image

Keep in mind that these are gzipped + minified size increases. The actual stat size for fontawesome-svg-core is 73.75 KB.
image

In fact, the lack of working tree-shaking means that inclusion of this library (and specifically the fontawesome-svg-core) alone nearly pushes you over Google's pagespeed recommendations for javascript bundle size. This is directly contrary to the mission statement of @FortAwesome's github. Tools to help you be moar betters on the web.

Can we please get some attention on this issue?

@robmadole @supercodepoet @talbs

@robmadole
Copy link
Member

@raymondtri you are referring to a different issue than originally reported for this issue (this one is focused on icons being tree-shaken). We'll deal with your stuff in FortAwesome/Font-Awesome#16005

@robmadole
Copy link
Member

@Bounty31 you'll probably have better luck asking the Vue team about this. Looks like switching the target change the behavior. I'm not sure why that would be. I'll leave this issue open.

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