Skip to content

How to make the app.js smaller? #1128

Answered by azat-io
JeremieLitzler asked this question in Q&A
Discussion options

You must be logged in to vote

Currently you are generating temp file with data of all your pages included your content:

    const pagesData = app.pages.map((page) => {
      console.log(page.filePathRelative);
      return page;
    });
    await app.writeTemp(
      'pages.js',
      `export default [${JSON.stringify(pagesData)}]`,
    );

And after then you are importing this file in your client code in components/PostsIndex.vue. This is the reason why your bundle is huge.

I tried to exclude data from the bundle that is not used in this component:
JeremieLitzler/journal#31

Thus, I managed to reduce the size from 6.9M to 1.2M. 🎉

But I still think that this solution is not the best solution.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@JeremieLitzler
Comment options

Answer selected by JeremieLitzler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants