Skip to content

Commit

Permalink
Change import to require
Browse files Browse the repository at this point in the history
  • Loading branch information
Bram-Zijp committed Aug 29, 2018
1 parent c8b55be commit e5f9c94
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/create-razzle-app/templates/default/src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import app from './server';
import http from 'http';

let app = require('./server').default;

const server = http.createServer(app);

let currentApp = app;
Expand All @@ -18,7 +19,7 @@ if (module.hot) {

const noErrors = () => {
try {
require('./server').default;
require('./server.js').default;
} catch (error) {
console.error(error);
return false;
Expand All @@ -30,9 +31,9 @@ if (module.hot) {
if (noErrors()) {
console.log('🔁 HMR Reloading `./server`...');
server.removeListener('request', currentApp);
const newApp = require('./server').default;
server.on('request', newApp);
currentApp = newApp;
app = require('./server').default;
server.on('request', app);
currentApp = app;
}
});
}

0 comments on commit e5f9c94

Please sign in to comment.