@@ -16,9 +16,12 @@ dotenv.config({
1616
1717const isPreview = process . env . PREVIEW ;
1818const isDev = process . env . NODE_ENV ;
19+ const workspaceId = process . env . WORKSPACE_ID ;
1920
2021if ( isDev || isPreview ) {
21- const livereloadServer = livereload . createServer ( ) ;
22+ const livereloadServer = livereload . createServer ( {
23+ host : "0.0.0.0" ,
24+ } ) ;
2225 livereloadServer . watch ( "dist" ) ;
2326 livereloadServer . server . once ( "connection" , ( ) => {
2427 console . log ( "✅ LiveReload connected" ) ;
@@ -28,7 +31,17 @@ if (isDev || isPreview) {
2831const app = express ( ) ;
2932app . use ( cors ( ) ) ;
3033// Inject the client-side livereload script into HTML responses
31- app . use ( connectLivereload ( ) ) ;
34+ app . use (
35+ // The port might not be right here for the ingress.
36+ // I need this route to be exposed
37+ connectLivereload ( {
38+ host : workspaceId
39+ ? `${ workspaceId } .workspace.pulse-editor.com"`
40+ : undefined ,
41+ port : workspaceId ? 443 : 35729 ,
42+ } )
43+ ) ;
44+
3245app . use ( express . json ( ) ) ;
3346
3447// Log each request to the console
@@ -70,17 +83,17 @@ if (isPreview) {
7083 }
7184 } ) ;
7285
73- app . listen ( 3030 ) ;
86+ app . listen ( 3030 , "0.0.0.0" ) ;
7487} else if ( isDev ) {
7588 /* Dev mode */
7689 app . use ( `/${ pulseConfig . id } /${ pulseConfig . version } ` , express . static ( "dist" ) ) ;
7790
78- app . listen ( 3030 ) ;
91+ app . listen ( 3030 , "0.0.0.0" ) ;
7992} else {
8093 /* Production mode */
8194 app . use ( `/${ pulseConfig . id } /${ pulseConfig . version } ` , express . static ( "dist" ) ) ;
8295
83- app . listen ( 3030 , ( ) => {
96+ app . listen ( 3030 , "0.0.0.0" , ( ) => {
8497 console . log ( `\
8598🎉 Your Pulse extension \x1b[1m${ pulseConfig . displayName } \x1b[0m is LIVE!
8699
0 commit comments