Skip to content

Commit

Permalink
Organize file and add more nodemon logging (#14)
Browse files Browse the repository at this point in the history
Spawned from vitejs/vite#8492
  • Loading branch information
MadLittleMods authored Jun 8, 2022
1 parent cc95832 commit 940c738
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions server/start-dev.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
'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');
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
//
Expand All @@ -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}`);
});

0 comments on commit 940c738

Please sign in to comment.