cli: filter js and map

This commit is contained in:
pengfei.zhou 2022-07-13 19:25:17 +08:00 committed by osborn
parent 3344fb0b9f
commit 179a95e2de

View File

@ -41,6 +41,9 @@ export default async function dev() {
alwaysStat: true, alwaysStat: true,
}) })
.on("change", (jsFile) => { .on("change", (jsFile) => {
if (!jsFile.endsWith(".js") && !jsFile.endsWith(".map")) {
return;
}
const content = fs.readFileSync(jsFile, "utf-8"); const content = fs.readFileSync(jsFile, "utf-8");
if (cachedContents[jsFile]) { if (cachedContents[jsFile]) {
if (content.indexOf(cachedContents[jsFile]) >= 0) { if (content.indexOf(cachedContents[jsFile]) >= 0) {