Joke Collection Website - Joke collection - How to view the component dependency tree when building a project with vue-cli

How to view the component dependency tree when building a project with vue-cli

When I think of grunt glup, what comes to mind is the image of running water.

When I think of webpack, I think of a giant who seems to have just woken up from Stonehenge's Gobekli. He is strong, but he is also fat.

Without any optimization, look at the file size after construction.

The average entrance size is over 400 k, which is unbearable ..................................................................................................................................................................

If you leak it here, everyone will laugh at you ... although it is ...

Time seems to have bitten me, and I went back to those years when I used maven. I remember myeclipse has a maven2 plugin-it can display the dependency tree of the current reference jar package.

So the next step is to know how the project is packaged and what it depends on. Nothing is more enjoyable than visualizing the dependency tree. ...

After some Google work, I finally found three artifacts that can be combined with vue-cli to output and build reports.

Put it in the plug-in configuration item of wepback.prod.js

However ... I used vue-cli, which was built as an independent module building operation.

Webpack.base.js webpack.prod.js is built-in, so it will be used.

Stats-web pack- plugin

After configuring the plug-in, run the build process once. If the file path is not added, stats.json will be output to the build output directory together with all your packaged files ~ ~

Take my project as an example, it is as big as 16m. ...

If you are interested, you can double-click to open it. ...

As you can see, I shamefully used the urban scavengers in Sui Dynasty ............................................................................................................................................................. ...

Ok ... after a hard week's work, I will have a massage at home. ...

With the help of analysis tools, let's see which points need to be optimized (those points that suddenly appear in your mind)

The following is my vendor package, that is, the package of the third-party module, which is as big as 600k K K. It is definitely a burden.

You can see the third-party libraries and generic classes I use here.

Corresponding solutions:

If you can do cdn, dump cdn.

If you can write it yourself, just write it yourself.

What is wasted is either finding a lighter substitute, changing other schemes, or writing it yourself (such as date processing).

20 16.6. 14 more

Current progress

To be continued ... the next goal is to kill jquery and sm ~