kylin9718 官方链接 - https://github.com/sindresorhus/rev-path/blob/master/index.js
'use strict';
const modifyFilename = require('modify-filename');
module.exports = (pth, hash) => {
if (!(pth && hash)) {
throw new Error('`path` and `hash` required');
}
return modifyFilename(pth, (filename, ext) => `${filename}-${hash}${ext}`);
};
module.exports.revert = (pth, hash) => {
if (!(pth && hash)) {
throw new Error('`path` and `hash` required');
}
return modifyFilename(pth, (filename, ext) => filename.replace(new RegExp(`-${hash}$`), '') + ext);
};
Laya的node_modules里的rev-path拉取下来,是改成+号的