perf/fix(v2): more efficient hot reload & consistent filegen ()

* perf(v2): efficient hot reload, consistent generated file

* changelog

* more
This commit is contained in:
Endi 2019-11-08 16:14:14 +07:00 committed by Yangshun Tay
parent 87f864e5ba
commit e04c8f140f
7 changed files with 60 additions and 6 deletions
packages/docusaurus-utils/src

View file

@ -31,6 +31,15 @@ export async function generate(
}
}
export function objectWithKeySorted(obj: Object) {
// https://github.com/lodash/lodash/issues/1459#issuecomment-253969771
return _(obj)
.toPairs()
.sortBy(0)
.fromPairs()
.value();
}
const indexRE = /(^|.*\/)index\.(md|js)$/i;
const extRE = /\.(md|js)$/;