Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 1x 1x 1x 1x 1x 1x | import * as fs from 'fs' import * as path from 'path' import * as webpack from 'webpack' import { projectPath } from '../internal' export const webpackManifest = (jsDest: string, dest: string, filename?: string) => { filename = filename || 'rev-manifest.json' return function(this: webpack.Compiler) { this.hooks.done.tap('webpackManifest', statsObject => { const stats = statsObject.toJson() const chunks = stats.assetsByChunkName const manifest: { [n: string]: any } = {} for (const key in chunks) { if (chunks.hasOwnProperty(key)) { const originalFilename = key + '.js' // https://github.com/vigetlabs/blendid/issues/232#issuecomment-171963233 const chunkName = typeof chunks[key] === 'string' ? chunks[key] : chunks[key][0] manifest[path.join(jsDest, originalFilename)] = path.join(jsDest, chunkName) } } fs.writeFileSync(projectPath(dest, filename), JSON.stringify(manifest)) }) } } |