Organize file and add more nodemon logging (#14)

Spawned from https://github.com/vitejs/vite/issues/8492
This commit is contained in:
Eric Eastwood 2022-06-07 20:27:22 -05:00 committed by GitHub
parent cc958326ea
commit 940c73868f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 13 deletions

View File

@ -1,5 +1,7 @@
'use strict';
console.log('start-dev process.env.NODE_ENV', process.env.NODE_ENV);
const path = require('path');
const nodemon = require('nodemon');
const { build } = require('vite');
@ -7,7 +9,15 @@ const mergeOptions = require('merge-options');
const viteConfig = require('../vite.config');
console.log('start-dev process.env.NODE_ENV', process.env.NODE_ENV);
// Build the client-side JavaScript bundle when we see any changes
build(
mergeOptions(viteConfig, {
build: {
// Rebuild when we see changes
watch: true,
},
})
);
// Listen for any changes to files and restart the Node.js server process
//
@ -30,16 +40,13 @@ nodemon
})
.on('restart', function (files) {
console.log('App restarted due to: ', files);
});
// Build the client-side JavaScript bundle when we see any changes
build(
mergeOptions(viteConfig, {
build: {
// Rebuild when we see changes
watch: true,
},
})
);
console.log('start-dev2 process.env.NODE_ENV', process.env.NODE_ENV);
.on('crash', function () {
console.log('Nodemon: script crashed for some reason');
})
// .on('watching', (file) => {
// console.log('watching');
// })
.on('log', function (data) {
console.log(`Nodemon logs: ${data.type}: ${data.message}`);
});