Argument: bool, inherits, default False

If True the server will re-read the stats file for each request and requests will block while webpack is running. See webpack.timeout to configure how long the requests will wait for webpack.


Argument: bool, default True

If True, pyramid_webpack will automatically set up the static view(s) for you. Disable this if you want to call add_static_view yourself (e.g. if you need to pass in custom parameters).


Argument: str

The directory that contains the compiled webpack bundles. This may be in three forms:

  • raw_relative_path - This path will be relative to your root project package
  • package:relative_path - This is a path relative to a package location
  • /absolute/path - An absolute path on disk

You will almost always need to supply a bundle_dir, but if you are using an external webserver for webpack.static_view_name, then you don’t need to provide it.


Argument: str, default webpack-DEFAULT

This will be the name argument passed to add_static_view.


Argument: str, default webpack-stats.json

The location of the webpack stats file generated by the webpack-bundle-tracker plugin. This path may be in the same three formats as webpack.bundle_dir.


Argument: float, inherits, default 0

Requests will block for this many seconds while waiting for webpack to finish compiling (if webpack.debug = True). A value of 0 will wait indefinitely.


Argument: list, inherits, default *.hot-update.js, *.map

When getting a bundle, ignore chunks that match these patterns. Uses glob matching.


Argument: list, inherits

When getting a bundle, ignore chunks that match these patterns. Uses PCRE matching.


Argument: list

List of names of other webpack configurations to load. See the section below for more detail.

Multiple Configs

If you have multiple instances of webpack running and generating bundles, you can load them as well by giving them names and adding them to the webpack.configs option. You can then configure those instances by prefixing the same options in the config file with webpack.<name>.. For example:

webpack.debug = True
webpack.bundle_dir = webpack/bundles
webpack.stats_file = webpack/stats.json
webpack.configs =

webpack.other.bundle_dir = webpack/other/bundles
webpack.other.stats_fie = webpack/other/stats.json

For any of the options that are marked as inherits (for example, webpack.debug), it will default to whatever value was provided to the default configuration. For example, the value of webpack.other.debug in the above example will default to True because webpack.debug = True.

For information on how to render bundles from different configs, see the docs on Rendering bundles into templates.

Static View Examples

Here we’ll go over a couple of example configurations for the asset static views and how they differ.

The simplest version can be used in development or production, and will serve the static assets using pyramid:

webpack.bundle_dir = webpack/bundles

If you’re running in production and want to serve the assets from a CDN, you can instead use a static_view_name:

# Don't need a webpack.bundle_dir
webpack.static_view_name = //

And if you want to full control over how the static views are set up, you can disable them:

webpack.static_view = False

And set it up yourself:

for config_name, state in config.registry.webpack.iteritems():
    # You should use state.static_view_path as the path.
    # That value is used to generate the urls via request.static_url()
    config.add_static_view(name="//" + config_name,