Skip to content

Commit

Permalink
Merge 7700a3f into 990d9ec
Browse files Browse the repository at this point in the history
  • Loading branch information
timkindberg committed Nov 19, 2019
2 parents 990d9ec + 7700a3f commit 4ba748b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
17 changes: 17 additions & 0 deletions README.md
Expand Up @@ -215,6 +215,23 @@ INSTALLED_APPS = (
<br>
### Webpack Optimized Chunks
Support for default webpack chunk optimizations is supported. The most basic way to enable optimized chunks is to add the
`optimize` section to your webpack config.
```js
{
...below plugins
optimization: {
splitChunks: {
chunks: 'all'
}
}
}
```
### Multiple webpack projects
Version 2.0 and up of webpack loader also supports multiple webpack configurations. The following configuration defines 2 webpack stats files in settings and uses the `config` argument in the template tags to influence which stats file to load the bundles from.
Expand Down
10 changes: 9 additions & 1 deletion webpack_loader/loader.py
Expand Up @@ -78,7 +78,15 @@ def get_bundle(self, bundle_name):
)

if assets.get('status') == 'done':
chunks = assets['chunks'].get(bundle_name, None)
chunks = []
for chunk_name, chunk_infos in assets['chunks'].items():
if chunk_name.startswith('vendors~') and bundle_name in chunk_name.split('~'):
new_chunks = []
new_chunks.extend(chunk_infos)
new_chunks.extend(chunks)
chunks = new_chunks
elif bundle_name in chunk_name.split('~'):
chunks.extend(chunk_infos)
if chunks is None:
raise WebpackBundleLookupError('Cannot resolve bundle {0}.'.format(bundle_name))
return self.filter_chunks(chunks)
Expand Down

0 comments on commit 4ba748b

Please sign in to comment.