Implement Code Splitting ⚡️ #588
Labels
hacktoberfest
Issues for Hacktoberfest
type: enhancement
make something that is already working even better
Milestone
We currently bundle every JavaScript and CSS into their own single bundle. We have a vendor bundle because third party packages change way less often than our own code, so that's a problem solved.
The problem we have now is that a small change on a specific component results into a completely new bundle which has to be downloaded by all users.
We should really look into Code Splitting and how that can help us push smaller javascript files to users. We could also think about using
optimization.splitChunks
.My idea is to split based on our Page Components that are described on router.tsx. Every Page Components would result into a separate bundle that is downloaded only when necessary.
Tasks:
import "./TagForm.scss"
. This css file should only be imported by TagForm. This was probably a copy-paste mistake.npx webpack -p --profile --json > compilation-stats.json
generates a very useful internal view of modules. This might help us resolve this issue.public/components/common
) to its own JS and CSS bundle. These components don't change that often, thus avoiding users having to download this over and over again. feature: add a common chunk #636import(/* webpackChunkName: "ShowPost.page" */ "@fider/pages/ShowPost/ShowPost.page");
. We can use this to preload this chunk as shown here: https://developers.google.com/web/updates/2016/03/link-rel-preload (PR: Add Webpack Chunk Names and Fix CSS Warnings #619)Resources:
The text was updated successfully, but these errors were encountered: