Skip to content
This repository has been archived by the owner on Nov 30, 2020. It is now read-only.

Built js files are too large #386

Open
tychenjiajun opened this issue Aug 12, 2019 · 3 comments
Open

Built js files are too large #386

tychenjiajun opened this issue Aug 12, 2019 · 3 comments
Assignees
Labels

Comments

@tychenjiajun
Copy link
Contributor

Describe the bug
The built js files in https://unpkg.com/browse/[email protected]/dist/button/ are too large compared to other components library like Element or Buefy.

To Reproduce
Steps to reproduce the behavior:

  1. Go to unpkg.com
  2. Check the file size.

Expected behavior
Built files should be smaller, maybe less than 10kb for each component.

@matsp
Copy link
Owner

matsp commented Aug 12, 2019

@tychenjiajun They are both not using mdc-web. Can't find the dependency. Our compononents are so big because of mdc-web.

@matsp matsp self-assigned this Aug 12, 2019
@Alan-Liang
Copy link
Contributor

Alan-Liang commented Aug 20, 2019

I made a size comparison of importing material-components-vue using different methods.

import method css size js size(vendor)
npm index.js 34.3K 585.6K
npm min.js 34.3K 192.7K
direct clone 34.3K 155.9K
  • npm index.js means import [component] from 'material-components-vue/dist/[component]'
  • npm min.js means import [component] from 'material-components-vue/dist/[component]/[component].min.js'
  • direct clone means cloning the repo then import [component] from '../material-components-vue/components/[component]'

Clearly index.js uses eval(), and that's bad for optimization. *.min.js is better, but has cross-references which leads to extra bytes.

These files are generated by vue-cli.

@cjblomqvist
Copy link

Probably due to the underlying library (material-components-web), which is developed by Google. So not much to do there (except for the first one).

It would be nice though if the components folder is brought along when publishing so one doesn't have to clone the repo to be able to go with the 3rd option. That also enables component-specific imports (now one must import/add each component globally).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants