Releases: MasterKale/django-cra-helper
Releases · MasterKale/django-cra-helper
2.0.1
2.0.0
Changes:
- Add liveserver support for
react-scripts@4.0.0and up - Add new
CRA_PACKAGE_JSON_HOMEPAGEsetting for Django settings.py to help contact liveserver when the Create-React-App project's package.json contains a value for"homepage".
Breaking Changes:
- Remove
jsontemplate tag for Django's built-injson_script.
To update your code, change the following in your HTML file that loads your React:
{% load cra_helper_tags %}
<html>
<!-- ..snip.. -->
<body>
<!-- ..snip.. -->
<script>
window.component = '{{ component }}';
window.props = {{ props | json }};
window.reactRoot = document.getElementById('react');
</script>
</body>
</html>To use Django's json_script template tag instead:
<html>
<!-- ..snip.. -->
<body>
<!-- ..snip.. -->
{{ props | json_script:"react-props" }}
<script>
window.component = '{{ component }}';
window.props = JSON.parse(
document.getElementById('react-props').textContent
);
window.reactRoot = document.getElementById('react');
</script>
</body>
</html>Support for CRA's "homepage" build path prefix
Adds support for CRA projects built with a "homepage" value specified in package.json.
See https://create-react-app.dev/docs/deployment/#building-for-relative-paths.
Security update
Bumps Bleach from v2 to v3.1.1 as per #7
Also includes some new info on how to get hot-reloading working with react-scripts@>=3.4.