import { resolve } from 'path' ; import * as webpack from 'webpack' ; const folderHash = require ( 'folder-hash' ) ; module . exports = function blogHashLoader ( this , blogPath ) { const callback = this . async ( ) ; this . addContextDependency ( resolve ( blogPath ) ) ; folderHash . hashElement ( blogPath ) . then ( ( blogHash ) => JSON . stringify ( { blogHash } ) ) . then ( ( json ) => `module.exports = ${ json };` ) . then ( ( result ) => { callback ( undefined , result ) ; } ) . catch ( ( error ) => { callback ( error ) ; } ) ; } ;