Skip to content

Conversation

rvlb
Copy link
Contributor

@rvlb rvlb commented Sep 13, 2021

Closes #282
Closes #275
Closes #277

@rvlb rvlb self-assigned this Sep 13, 2021
@rvlb rvlb marked this pull request as ready for review October 4, 2021 21:13
@rvlb rvlb requested a review from fjsj October 4, 2021 21:13
@rvlb rvlb assigned fjsj and unassigned rvlb Oct 4, 2021
README.md Outdated
```javascript
new BundleTracker({filename: './webpack-stats.json'})
```
During development, when files change a lot, we want to always poll for the updated files (in our case, we'll fetch the files every 0.1s, as defined on `POLL_INTERVAL`).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

POLL_INTERVAL is ignored when CACHE is True? If so, please clarify here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated this section with more explanation

For that setup, we're using the `DEBUG` variable provided by Django when bootstraping a new project. Since in a production environment (`DEBUG = False`) the assets files won't constantly change, we can safely cache the results (`CACHE=True`) and optimize our flow, as `django-webpack-loader` will read the stats file only once and store the assets files paths in memory. From that point pnwards, it will use these stored paths as the source of truth. If `CACHE=False`, we'll always read the stats file to get the assets paths.
> If `CACHE=True`, any changes made in the assets files will only be read when the web workers are restarted.
During development, when the stats file changes a lot, we want to always poll for its updated version (in our case, we'll fetch it every 0.1s, as defined on `POLL_INTERVAL`).
> In production (`DEBUG=False`), we'll only fetch the stats file once, so `POLL_INTERVAL` is ignored.
While `CACHE` isn't directly related to `POLL_INTERVAL`, it's interesting to keep `CACHE` binded to the `DEBUG` logic value (in this case, the negation of the logic value) in order to only cache the assets in production, as we'd not continuously poll the stats file in that environment.

@@ -278,105 +171,8 @@ The `is_preload=True` option in the `render_bundle` template tag can be used to
</html>
```

### Skipping the generation of multiple common chunks
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's worth including this again.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

</head>
```

### File URLs instead of html tags
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this still exist?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does, re-added this section to the readme

Copy link
Member

@fjsj fjsj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check comments.

@rvlb rvlb requested a review from fjsj October 9, 2021 02:43
Copy link
Member

@fjsj fjsj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fjsj fjsj merged commit 1756680 into master Oct 18, 2021
@fjsj fjsj deleted the feat/readme-revamp branch October 18, 2021 18:19
@ChrisCrossCrash
Copy link

Thanks a lot for this! I tried the tutorial linked in the README a few months ago, but I couldn't get it working. I'll give it a shot following the new README.

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

Successfully merging this pull request may close these issues.

Simplify README with better examples Add Code Splitting section to README Outdated tutorial link in README.md?
3 participants