diff --git a/package.json b/package.json index b3daed3..e07f94a 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "babel-preset-stage-0": "^6.5.0", "babel-register": "^6.7.2", "babel-runtime": "^6.26.0", + "clean-webpack-plugin": "^0.1.19", "compression-webpack-plugin": "^1.1.11", "css-loader": "^0.28.11", "css-modules-require-hook": "^4.0.6", @@ -53,6 +54,7 @@ "webpack": "^4.7.0", "webpack-cli": "^2.1.2", "webpack-dev-middleware": "^3.1.3", - "webpack-hot-middleware": "^2.18.0" + "webpack-hot-middleware": "^2.18.0", + "webpack-manifest-plugin": "^2.0.3" } } diff --git a/src/utils/serverRender.js b/src/utils/serverRender.js index 2a8640b..c7134b5 100644 --- a/src/utils/serverRender.js +++ b/src/utils/serverRender.js @@ -3,6 +3,7 @@ import React from 'react' import { renderToString } from 'react-dom/server' import { StaticRouter as Router } from 'react-router-dom' import { App } from '../components/App' +import manifest from '../../public/static/manifest.json' function serverRender(req, res) { let markup = ''; @@ -15,10 +16,10 @@ function serverRender(req, res) { , ); - return res.status(status).send(renderFullPage(markup)); + return res.status(status).send(renderFullPage(markup, manifest)); } -function renderFullPage(html) { +function renderFullPage(html, manifest) { return ` @@ -30,11 +31,11 @@ function renderFullPage(html) { - + ${process.env.NODE_ENV === 'production' ? `` : ''}