Stop restarting server when the client bundle updates

This commit is contained in:
Eric Eastwood 2022-02-15 17:30:30 -06:00
parent e0279e080e
commit 6c1cf6d46a
6 changed files with 24 additions and 4 deletions

View File

@ -3,8 +3,9 @@
var http = require('http');
/* Create an error as per http://bluebirdjs.com/docs/api/catch.html */
function StatusError(status, message) {
if (!message) {
function StatusError(status, inputMessage) {
let message = inputMessage;
if (!inputMessage) {
message = http.STATUS_CODES[status] || http.STATUS_CODES['500'];
}

View File

@ -6,10 +6,14 @@ const mergeOptions = require('merge-options');
const viteConfig = require('../vite.config');
// See https://github.com/remy/nodemon/blob/main/doc/requireable.md
// Listen for any changes to files and restart the Node.js server process
//
// For API docs, see
// https://github.com/remy/nodemon/blob/main/doc/requireable.md
nodemon({
script: path.join(__dirname, './server.js'),
ext: 'js json',
ignore: [path.join(__dirname, '../dist/*')],
});
nodemon
@ -24,10 +28,11 @@ nodemon
console.log('App restarted due to: ', files);
});
// Build the client-side bundle
// Build the client-side JavaScript bundle when we see any changes
build(
mergeOptions(viteConfig, {
build: {
// Rebuild when we see changes
watch: true,
},
})

5
shared/.eslintrc.json Normal file
View File

@ -0,0 +1,5 @@
{
"env": {
"browser": true
}
}

View File

@ -1,3 +1,5 @@
'use strict';
const { TemplateView, RoomView, RightPanelView } = require('hydrogen-view-sdk');
class ArchiveView extends TemplateView {

View File

@ -1,3 +1,5 @@
'use strict';
const assert = require('matrix-public-archive-shared/lib/assert');
const {
Platform,
@ -223,4 +225,7 @@ async function mountHydrogen() {
app.replaceChildren(view.mount());
}
// N.B.: When we run this in a `vm`, it will return the last statement. It's
// important to leave this as the last statement so we can await the promise it
// returns and signal that all of the async tasks completed.
mountHydrogen();

View File

@ -1,4 +1,6 @@
// vite.config.js
'use strict';
const path = require('path');
const { defineConfig } = require('vite');