From 9a356f88a1849cd0ef4f59f0cc6a099c7a28796a Mon Sep 17 00:00:00 2001 From: William Chargin Date: Mon, 23 Jul 2018 12:31:00 -0700 Subject: [PATCH] Use route data for static site source of truth Summary: This removes the hard-coded route data from the Webpack config, replacing it with the list of paths exported by the route data module. Test Plan: Note that the output of `yarn build` is identical before and after this change: namely, ```shell $ find build -exec shasum -a 256 {} + | shasum -a 256 7610a61f8a977f1d8edd849fc81256ca15f41f366e5fdb4b59a5d5ce37d6d58e ``` wchargin-branch: non-hard-coded-route-data --- config/paths.js | 1 + config/webpack.config.prod.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/config/paths.js b/config/paths.js index f0e4e5c..1830060 100644 --- a/config/paths.js +++ b/config/paths.js @@ -40,6 +40,7 @@ module.exports = { appHtml: resolveApp("src/app/public/index.html"), appIndexJs: resolveApp("src/app/index.js"), appServerSideRenderingIndexJs: resolveApp("src/app/server.js"), + appRouteData: resolveApp("src/app/routeData.js"), appPackageJson: resolveApp("package.json"), appSrc: resolveApp("src"), yarnLockFile: resolveApp("yarn.lock"), diff --git a/config/webpack.config.prod.js b/config/webpack.config.prod.js index 229c357..67dd75c 100644 --- a/config/webpack.config.prod.js +++ b/config/webpack.config.prod.js @@ -164,7 +164,7 @@ module.exports = { plugins: [ new StaticSiteGeneratorPlugin({ entry: "ssr", - paths: /* TODO(@wchargin): Non-hard-coded routes */ ["/", "/explorer"], + paths: require(paths.appRouteData).routeData.map(({path}) => path), locals: {}, }), // Makes some environment variables available to the JS code, for example: