Stop restarting server when the client bundle updates
This commit is contained in:
parent
e0279e080e
commit
6c1cf6d46a
|
@ -3,8 +3,9 @@
|
||||||
var http = require('http');
|
var http = require('http');
|
||||||
|
|
||||||
/* Create an error as per http://bluebirdjs.com/docs/api/catch.html */
|
/* Create an error as per http://bluebirdjs.com/docs/api/catch.html */
|
||||||
function StatusError(status, message) {
|
function StatusError(status, inputMessage) {
|
||||||
if (!message) {
|
let message = inputMessage;
|
||||||
|
if (!inputMessage) {
|
||||||
message = http.STATUS_CODES[status] || http.STATUS_CODES['500'];
|
message = http.STATUS_CODES[status] || http.STATUS_CODES['500'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,14 @@ const mergeOptions = require('merge-options');
|
||||||
|
|
||||||
const viteConfig = require('../vite.config');
|
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({
|
nodemon({
|
||||||
script: path.join(__dirname, './server.js'),
|
script: path.join(__dirname, './server.js'),
|
||||||
ext: 'js json',
|
ext: 'js json',
|
||||||
|
ignore: [path.join(__dirname, '../dist/*')],
|
||||||
});
|
});
|
||||||
|
|
||||||
nodemon
|
nodemon
|
||||||
|
@ -24,10 +28,11 @@ nodemon
|
||||||
console.log('App restarted due to: ', files);
|
console.log('App restarted due to: ', files);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Build the client-side bundle
|
// Build the client-side JavaScript bundle when we see any changes
|
||||||
build(
|
build(
|
||||||
mergeOptions(viteConfig, {
|
mergeOptions(viteConfig, {
|
||||||
build: {
|
build: {
|
||||||
|
// Rebuild when we see changes
|
||||||
watch: true,
|
watch: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"browser": true
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,3 +1,5 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
const { TemplateView, RoomView, RightPanelView } = require('hydrogen-view-sdk');
|
const { TemplateView, RoomView, RightPanelView } = require('hydrogen-view-sdk');
|
||||||
|
|
||||||
class ArchiveView extends TemplateView {
|
class ArchiveView extends TemplateView {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
const assert = require('matrix-public-archive-shared/lib/assert');
|
const assert = require('matrix-public-archive-shared/lib/assert');
|
||||||
const {
|
const {
|
||||||
Platform,
|
Platform,
|
||||||
|
@ -223,4 +225,7 @@ async function mountHydrogen() {
|
||||||
app.replaceChildren(view.mount());
|
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();
|
mountHydrogen();
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
// vite.config.js
|
// vite.config.js
|
||||||
|
'use strict';
|
||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const { defineConfig } = require('vite');
|
const { defineConfig } = require('vite');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue