@@ -4,7 +4,7 @@ import { renderToString } from 'react-dom/server';
44import * as fs from 'fs' ;
55import AppComponent from './components/app' ;
66import { getItems } from './db' ;
7- import { faviconUrl , stylesUrl , reactUrl , reactDomUrl , bundleUrl , propsUrl , containerId } from './constants' ;
7+ import { faviconUrl , stylesUrl , reactUrl , reactDomUrl , browserUrl , browserMapUrl , propsUrl , containerId } from './constants' ;
88
99console . log ( 'Server booting...' ) ;
1010const isProd = process . env . NODE_ENV === 'production' ;
@@ -31,7 +31,7 @@ createServer((req, res) => {
3131 <div id="${ containerId } ">${ reactHtml } </div>
3232 <script src="${ reactUrl } "></script>
3333 <script src="${ reactDomUrl } "></script>
34- <script src="${ bundleUrl } "></script>
34+ <script src="${ browserUrl } "></script>
3535 </body>
3636 </html>` ;
3737 res . setHeader ( 'Content-Type' , 'text/html' ) ;
@@ -61,12 +61,18 @@ createServer((req, res) => {
6161 if ( err ) { console . error ( err ) ; }
6262 res . end ( data ) ;
6363 } ) ;
64- } else if ( req . url === bundleUrl ) {
64+ } else if ( req . url === browserUrl ) {
6565 res . setHeader ( 'Content-Type' , 'text/javascript' ) ;
6666 fs . readFile ( './dist/browser.js' , ( err , data ) => {
6767 if ( err ) { console . error ( err ) ; }
6868 res . end ( data ) ;
6969 } ) ;
70+ } else if ( req . url === browserMapUrl ) {
71+ res . setHeader ( 'Content-Type' , 'text/javascript' ) ;
72+ fs . readFile ( './dist/browser.js.map' , ( err , data ) => {
73+ if ( err ) { console . error ( err ) ; }
74+ res . end ( data ) ;
75+ } ) ;
7076 } else {
7177 res . setHeader ( 'Content-Type' , 'text/plain' ) ;
7278 res . statusCode = 404 ;
0 commit comments