Skip to content

Manifest file

Steven Pribilinskiy edited this page Jun 20, 2017 · 12 revisions

Asset collection

What exactly happens when the app/console webpack:[compile|watch|devserver] command is called:

  • Existing webpack_manifest.json file (left from previous compilation) is removed

  • Data for the main webpack.config.js is collected in WebpackConfigManager->collectAndDump(). That file is then written to app/cache directory.

    Eventually that file will be excecuted with webpack.

    It requires the webpack.symfony.config.js and provides the collected data in the options object:

    • aliases
    • entry points
    • commons chunk(s)

    The WebpackConfigModel has a cacheContext property which will contain modification time and an array of collected assets. It is used for caching purposes, to make sure that the webpack process will be restarted only when a

  • The twig files are parsed with the registered WebpackTokenParser

Under the hood symfony-webpack uses the assets-webpack-plugin. That plugin generates a webpack_manifest.json file in /app/cache dir. That file has mappings to the compiled file names in the following form:

{ 
    [entryPoint]: [compiledFilePath],
    [commonsChunk]: [compiledFilePath],
    [asset]: [compiledFilePath],
}

Eventually it is converted to the webpack_manifest.php file

webpack_manifest.php

This file contains mappings to the compiled files

Predictable long term caching with NamedChunksPlugin and NamedModulesPlugin

https://medium.com/webpack/predictable-long-term-caching-with-webpack-d3eee1d3fa31