From 415210b772f9f3090fa2c0863671dcb0003af4f5 Mon Sep 17 00:00:00 2001 From: William Chargin Date: Thu, 1 Nov 2018 13:24:31 -0700 Subject: [PATCH] webpack: remove dynamic import (#982) Summary: This import does not need to be dynamic; the fact that it is loses us safety for no benefit. (When I originally wrote it, it was less obviously bad, but the surrounding code has changed over time.) Test Plan: Running `yarn flow` suffices, and now actually checks this module instead of typing it as `any`. Running `yarn test --full` is nice, too. wchargin-branch: webpack-remove-dynamic-import --- config/paths.js | 1 - config/webpack.config.web.js | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/paths.js b/config/paths.js index fa4db86..e1e0201 100644 --- a/config/paths.js +++ b/config/paths.js @@ -15,7 +15,6 @@ module.exports = { appBuild: resolveApp("build"), appIndexJs: resolveApp("src/homepage/index.js"), appServerSideRenderingIndexJs: resolveApp("src/homepage/server.js"), - appRouteData: resolveApp("src/homepage/routeData.js"), appPackageJson: resolveApp("package.json"), appSrc: resolveApp("src"), yarnLockFile: resolveApp("yarn.lock"), diff --git a/config/webpack.config.web.js b/config/webpack.config.web.js index f159712..e5a6198 100644 --- a/config/webpack.config.web.js +++ b/config/webpack.config.web.js @@ -221,8 +221,9 @@ function plugins(mode /*: "development" | "production" */) { const basePlugins = [ new StaticSiteGeneratorPlugin({ entry: "ssr", - // $ExpectFlowError(dynamic require) - paths: require(paths.appRouteData).routeData.map(({path}) => path), + paths: require("../src/homepage/routeData").routeData.map( + ({path}) => path + ), locals: {}, }), new CopyPlugin([{from: paths.favicon, to: "favicon.png"}]),