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

Vendor file big and take long time to load #12

Open
AhmedSalamaM opened this issue Mar 27, 2020 · 3 comments
Open

Vendor file big and take long time to load #12

AhmedSalamaM opened this issue Mar 27, 2020 · 3 comments

Comments

@AhmedSalamaM
Copy link

after build , system take long time to load and vendor file size very big 9 M
what should i do ?

@tsv2013
Copy link
Member

tsv2013 commented Mar 28, 2020

The vendor bundle contains all the scripts used in this application. Since the app consists from one page only, the bundle contains all the scrips and loaded at once.

In real application that contains different pages and different libraries are loaded on different pages it is possible to load scripts on-demand only when scripts are really required.

This can be achieved via webpack "dynamic import" technique for example.
https://medium.com/front-end-weekly/webpack-and-dynamic-imports-doing-it-right-72549ff49234
https://webpack.js.org/guides/code-splitting/

We're going to re-work this example: split it on several pages: home page, survey creator page, survey page and PDF export page. In this case we will be able to use dynamic import of some libraries. But this work will take some time.

@tsv2013
Copy link
Member

tsv2013 commented Mar 28, 2020

At the same time on your side, in your real application you can setup webpack "dynamic import" using the articles mentioned above:
https://medium.com/front-end-weekly/webpack-and-dynamic-imports-doing-it-right-72549ff49234
https://webpack.js.org/guides/code-splitting/

@tsv2013
Copy link
Member

tsv2013 commented Mar 29, 2020

I've added vue-router (https://router.vuejs.org/) to the application, split the main view into Home/Survey/Creator/Export and added lazy page loading (https://github.com/vuejs/vue-router/tree/dev/examples/lazy-loading)

You are welcome to check the results

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

No branches or pull requests

2 participants