Fix webpack HMR

This commit is contained in:
QWp6t
2016-09-11 11:39:48 -07:00
parent 3516629add
commit 10899cf2cd
11 changed files with 154 additions and 53 deletions

View File

@@ -0,0 +1,18 @@
const path = require('path');
/**
* Process AssetsPlugin output and format it
* for Sage: {"[name].[ext]":"[name]_[hash].[ext]"}
* @param {Object} assets passed by processOutput
* @return {String} JSON
*/
module.exports = (assets) => {
const results = {};
Object.keys(assets).forEach(name => {
Object.keys(assets[name]).forEach(ext => {
const filename = `${path.dirname(assets[name][ext])}/${path.basename(`${name}.${ext}`)}`;
results[filename] = assets[name][ext];
});
});
return JSON.stringify(results);
};