Compare commits

..

2 Commits

Author SHA1 Message Date
hyper 385bcb16d8 fix: dev server not showing pngs 2026-04-08 19:56:44 +08:00
hyper afe2eb4af8 fix: cli file change detection now includes csv/yarn 2026-04-08 19:43:32 +08:00
2 changed files with 6 additions and 3 deletions

View File

@ -40,5 +40,8 @@ export default defineConfig({
distPath: {
root: 'dist/web',
},
copy: process.env.NODE_ENV === 'development' ? [
{ from: './content', to: 'content' }
] : [],
},
});

View File

@ -223,7 +223,7 @@ export function createContentServer(
watcher
.on("add", (path) => {
if (path.endsWith(".md")) {
if (path.endsWith(".md") || path.endsWith(".csv") || path.endsWith(".yarn")) {
try {
const content = readFileSync(path, "utf-8");
const relPath = "/" + relative(contentDir, path).split(sep).join("/");
@ -235,7 +235,7 @@ export function createContentServer(
}
})
.on("change", (path) => {
if (path.endsWith(".md")) {
if (path.endsWith(".md") || path.endsWith(".csv") || path.endsWith(".yarn")) {
try {
const content = readFileSync(path, "utf-8");
const relPath = "/" + relative(contentDir, path).split(sep).join("/");
@ -247,7 +247,7 @@ export function createContentServer(
}
})
.on("unlink", (path) => {
if (path.endsWith(".md")) {
if (path.endsWith(".md") || path.endsWith(".csv") || path.endsWith(".yarn")) {
const relPath = "/" + relative(contentDir, path).split(sep).join("/");
delete contentIndex[relPath];
console.log(`[删除] ${relPath}`);