Created
September 2, 2019 19:43
-
-
Save ScriptedAlchemy/f667d4eda6eaa749082e643c88b48663 to your computer and use it in GitHub Desktop.
Render Manifest Webpack Plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| compilation.mainTemplate.hooks.renderManifest.tap( | |
| 'URLImportPlugin', | |
| (result, { chunk }) => { | |
| console.log(chunk); | |
| const renderedModules = Array.from(chunk.modulesIterable).filter( | |
| (module) => module.type === MODULE_TYPE | |
| ); | |
| if (renderedModules.length > 0) { | |
| result.push({ | |
| render: () => | |
| this.renderContentAsset( | |
| compilation, | |
| chunk, | |
| renderedModules, | |
| compilation.runtimeTemplate.requestShortener | |
| ), | |
| filenameTemplate: ({ chunk: chunkData }) => | |
| this.options.moduleFilename(chunkData), | |
| pathOptions: { | |
| chunk, | |
| contentHashType: MODULE_TYPE, | |
| }, | |
| identifier: `${pluginName}.${chunk.id}`, | |
| hash: chunk.contentHash[MODULE_TYPE], | |
| }); | |
| } | |
| }, | |
| ); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment