Handle missing announcement file in dev-server
This commit is contained in:
parent
8c06dab10f
commit
ceca6e3b84
1 changed files with 4 additions and 1 deletions
|
@ -7,7 +7,10 @@ const loadAnnouncements = (homepageKeys) => {
|
||||||
|
|
||||||
homepageKeys.forEach((key) => {
|
homepageKeys.forEach((key) => {
|
||||||
const file = path.join(__dirname, `../dist/announcement/${key.toLowerCase()}.md`);
|
const file = path.join(__dirname, `../dist/announcement/${key.toLowerCase()}.md`);
|
||||||
const announcement = fs.readFileSync(file, 'utf8');
|
let announcement;
|
||||||
|
try {
|
||||||
|
announcement = fs.readFileSync(file, 'utf8');
|
||||||
|
} catch {}
|
||||||
announcements[key] = announcement ? announcement.trim() : '';
|
announcements[key] = announcement ? announcement.trim() : '';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue