File tree Expand file tree Collapse file tree 3 files changed +1275
-28
lines changed
Expand file tree Collapse file tree 3 files changed +1275
-28
lines changed Original file line number Diff line number Diff line change 11const { join } = require ( 'node:path' )
22
3+ const browserSync = require ( 'browser-sync' )
4+ const { createProxyMiddleware } = require ( 'http-proxy-middleware' )
5+
36const build = require ( './build' )
47const expressMiddleware = require ( './express-middleware' )
58const expressSettings = require ( './express-settings' )
@@ -79,7 +82,29 @@ NHSPrototypeKit.prototype.start = async function (port) {
7982 if ( nodeEnv === 'production' ) {
8083 console . info ( `Running on port ${ availablePort } ` )
8184 } else {
82- console . info ( `Running at http://localhost:${ availablePort } /` )
85+ const bs = browserSync . create ( )
86+
87+ bs . init ( {
88+ port : availablePort ,
89+ files : [ 'views/**/*.*' , 'assets/**/*.*' ] ,
90+
91+ // We create our own proxy middleware here
92+ // as the default proxy option does not work
93+ // on GitHub Codespaces.
94+ middleware : createProxyMiddleware ( {
95+ changeOrigin : true ,
96+ target : `http://localhost:${ availablePort } `
97+ } ) ,
98+ server : {
99+ baseDir : join ( __dirname , 'public' )
100+ } ,
101+
102+ ghostMode : false ,
103+ open : false ,
104+ notify : true ,
105+ watch : true ,
106+ ui : false
107+ } )
83108 }
84109 } )
85110}
You can’t perform that action at this time.
0 commit comments