File tree Expand file tree Collapse file tree 1 file changed +18
-16
lines changed Expand file tree Collapse file tree 1 file changed +18
-16
lines changed Original file line number Diff line number Diff line change @@ -936,26 +936,28 @@ class Server {
936
936
}
937
937
938
938
serveMagicHtml ( req , res , next ) {
939
- const _path = req . path ;
939
+ this . middleware . waitUntilValid ( ( ) => {
940
+ const _path = req . path ;
940
941
941
- try {
942
- const filename = this . middleware . getFilenameFromUrl ( `${ _path } .js` ) ;
943
- const isFile = this . middleware . context . outputFileSystem
944
- . statSync ( filename )
945
- . isFile ( ) ;
942
+ try {
943
+ const filename = this . middleware . getFilenameFromUrl ( `${ _path } .js` ) ;
944
+ const isFile = this . middleware . context . outputFileSystem
945
+ . statSync ( filename )
946
+ . isFile ( ) ;
946
947
947
- if ( ! isFile ) {
948
- return next ( ) ;
949
- }
948
+ if ( ! isFile ) {
949
+ return next ( ) ;
950
+ }
950
951
951
- // Serve a page that executes the javascript
952
- const queries = req . _parsedUrl . search || '' ;
953
- const responsePage = `<!DOCTYPE html><html><head><meta charset="utf-8"/></head><body><script type="text/javascript" charset="utf-8" src="${ _path } .js${ queries } "></script></body></html>` ;
952
+ // Serve a page that executes the javascript
953
+ const queries = req . _parsedUrl . search || '' ;
954
+ const responsePage = `<!DOCTYPE html><html><head><meta charset="utf-8"/></head><body><script type="text/javascript" charset="utf-8" src="${ _path } .js${ queries } "></script></body></html>` ;
954
955
955
- res . send ( responsePage ) ;
956
- } catch ( error ) {
957
- return next ( ) ;
958
- }
956
+ res . send ( responsePage ) ;
957
+ } catch ( error ) {
958
+ return next ( ) ;
959
+ }
960
+ } ) ;
959
961
}
960
962
961
963
// Send stats to a socket or multiple sockets
You can’t perform that action at this time.
0 commit comments