skillfed

django-webpack-loader

Transparently use webpack with django

django-webpack-loader v3.2.4 969.9K downloads/30d#4,611 on PyPI2,541
Permissive license MIT License Active released

What it is and what it does

Django Webpack Loader bridges Webpack and Django by consuming a stats file (webpack-stats.json) generated by webpack-bundle-tracker and exposing a template tag to render compiled bundles. It reads bundle metadata at runtime and injects the correct script and link tags into Django templates, handling asset paths and caching based on the DEBUG setting.

The package has no runtime dependencies and integrates directly into Django's template system. During development, it polls the stats file frequently to reflect live changes; in production, it caches the file once to minimize I/O. Configuration is done via Django settings, specifying the stats file location, bundle directory, and optional regex patterns to exclude certain assets.

Use it for:

  • Render CSS and JavaScript bundles compiled by Webpack into Django templates using a single template tag.
  • Develop Django projects with hot-reloading frontend assets by polling the stats file during development.
  • Cache bundle paths in production to avoid repeated stats file reads while serving pre-compiled assets.
  • Exclude specific generated files (e.g., source maps, hot-update files) from template rendering via regex patterns.
  • Integrate multiple Webpack entry points into different parts of a Django template for code splitting.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Integrates Webpack-compiled bundles into Django templates via a simple template tag that reads a stats file generated by webpack-bundle-tracker.

Yes. The package is actively maintained, has no runtime dependencies, supports current Django and Python versions, carries a permissive MIT license, and solves a common pain point in Django–Webpack integration. Install it if you are using Webpack to compile frontend assets for a Django project.

Install

django-webpack-loader on PyPI

pip

pip install django-webpack-loader

uv

uv add django-webpack-loader

poetry

poetry add django-webpack-loader

Installing django-webpack-loader

Before you install

Low install friction with no runtime dependencies. Actively maintained with recent releases; supports modern Django (4.2–5.2) and Python (3.8–3.13) versions.

License in practice

MIT License permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and proprietary projects.

Quickstart

# Install
pip install django-webpack-loader

# In Django settings.py
INSTALLED_APPS = [
    ...
    'webpack_loader',
]

WEBPACK_LOADER = {
    'DEFAULT': {
        'STATS_FILE': '/path/to/webpack-stats.json',
    }
}

# In a Django template
{% load render_bundle from webpack_loader %}
{% render_bundle 'main' 'css' %}

webpack-bundle-tracker must be configured in your Webpack build to generate the stats file before django-webpack-loader can read it.

Verify before relying

  • Whether the package works with Webpack versions other than Webpack 5 (documentation mentions examples in Webpack 5 but does not explicitly state version compatibility).
  • Whether hot-reload functionality is production-ready or development-only (documentation references a 'specific config' but details are not included in the excerpt).

Package facts

License MIT License (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 93 days since the last release
Last repo commit
First released
Downloads 969,888/month — #4,611 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: django_webpack_loader-3.2.4-py2.py3-none-any.whl

Keywords: django, webpack, assets

Environment :: Web EnvironmentFramework :: DjangoFramework :: Django :: 4.2Framework :: Django :: 5.0Framework :: Django :: 5.1Framework :: Django :: 5.2License :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

webpack django integrationdjango template webpack bundleswebpack stats file djangodjango static assets webpackrender webpack bundles djangodjango webpack loader template tag
django-integrationwebpackfrontend-tooling

More Build Tools packages